ContextMenu (windows only)

This commit is contained in:
2022-05-28 21:59:43 +02:00
parent 6e7742a08a
commit fbf36b890b
12 changed files with 508 additions and 30 deletions

View File

@@ -0,0 +1,30 @@
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data.Converters;
using FileTime.App.Core.ViewModels;
using FileTime.GuiApp.Services;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.GuiApp.Converters;
public class ContextMenuGenerator : IValueConverter
{
private IContextMenuProvider? _contextMenuProvider;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
_contextMenuProvider ??= DI.ServiceProvider.GetRequiredService<IContextMenuProvider>();
if (value is IContainerViewModel containerViewModel)
{
return _contextMenuProvider.GetContextMenuForFolder(containerViewModel.Container);
}
return new object[] { new MenuItem() { Header = "asd" } };
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}