31 lines
901 B
C#
31 lines
901 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using Microsoft.UI.Xaml.Markup;
|
|
|
|
namespace WinWARP.Ui.Converters;
|
|
|
|
[MarkupExtensionReturnType(ReturnType = typeof(IValueConverter))]
|
|
public class ItemInvokedEventArgsConverter : MarkupExtension, IValueConverter
|
|
{
|
|
protected override object ProvideValue() => this;
|
|
|
|
public object? Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if (value is NavigationViewItemInvokedEventArgs args)
|
|
{
|
|
if (args.InvokedItemContainer?.Tag is Type viewModelType)
|
|
{
|
|
return viewModelType;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
} |