mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
init
This commit is contained in:
@@ -63,9 +63,13 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
|
|||||||
{
|
{
|
||||||
return item as IContextItem;
|
return item as IContextItem;
|
||||||
}
|
}
|
||||||
|
else if (item is CommandContextItemViewModel commandItem)
|
||||||
|
{
|
||||||
|
return commandItem.Model.Unsafe;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ((CommandContextItemViewModel)item).Model.Unsafe;
|
return null;
|
||||||
}
|
}
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,14 @@ internal sealed partial class ContextItemTemplateSelector : DataTemplateSelector
|
|||||||
li.AllowFocusOnInteraction = false;
|
li.AllowFocusOnInteraction = false;
|
||||||
dataTemplate = Separator;
|
dataTemplate = Separator;
|
||||||
}
|
}
|
||||||
|
else if (item is CommandContextItemViewModel commandItem)
|
||||||
|
{
|
||||||
|
dataTemplate = commandItem.IsCritical ? Critical : Default;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dataTemplate = ((CommandContextItemViewModel)item).IsCritical ? Critical : Default;
|
// Fallback for unknown types
|
||||||
|
dataTemplate = Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,22 @@
|
|||||||
<Application>
|
<Application>
|
||||||
<Assembly Name="Microsoft.WinUI">
|
<Assembly Name="Microsoft.WinUI">
|
||||||
<Type Name="Microsoft.UI.Xaml.Controls.FontIconSource" Dynamic="Required All" />
|
<Type Name="Microsoft.UI.Xaml.Controls.FontIconSource" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.UI.Xaml.DataTemplate" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.UI.Xaml.Controls.DataTemplateSelector" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.UI.Xaml.Controls.ListViewItem" Dynamic="Required All" />
|
||||||
|
</Assembly>
|
||||||
|
|
||||||
|
<!-- Add ViewModel types for AOT compatibility -->
|
||||||
|
<Assembly Name="Microsoft.CmdPal.Core.ViewModels">
|
||||||
|
<Type Name="Microsoft.CmdPal.Core.ViewModels.CommandContextItemViewModel" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.CmdPal.Core.ViewModels.SeparatorContextItemViewModel" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.CmdPal.Core.ViewModels.IContextItemViewModel" Dynamic="Required All" />
|
||||||
|
<Type Name="Microsoft.CmdPal.Core.ViewModels.CommandItemViewModel" Dynamic="Required All" />
|
||||||
|
</Assembly>
|
||||||
|
|
||||||
|
<!-- Add UI types for AOT compatibility -->
|
||||||
|
<Assembly Name="Microsoft.CmdPal.UI">
|
||||||
|
<Type Name="Microsoft.CmdPal.UI.ContextItemTemplateSelector" Dynamic="Required All" />
|
||||||
</Assembly>
|
</Assembly>
|
||||||
</Application>
|
</Application>
|
||||||
</Directives>
|
</Directives>
|
||||||
|
|||||||
Reference in New Issue
Block a user