mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Fully initialize context menus when they change (#38998)
If we don't slow-initialize the whole menu when it changes, then we won't see that there's secondary (& more) commands. Tested this with the extension from [waaverecords/CmdPal.Ext.Spotify#4](https://github.com/waaverecords/CmdPal.Ext.Spotify/pull/4) Closes #38959 Also seemingly closes #38347 - seems that needed additional bumping of the `EmptyContent`'s
This commit is contained in:
@@ -29,6 +29,8 @@ public partial class CommandBarViewModel : ObservableObject,
|
|||||||
|
|
||||||
field = value;
|
field = value;
|
||||||
SetSelectedItem(value);
|
SetSelectedItem(value);
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(SelectedItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +117,10 @@ public partial class CommandBarViewModel : ObservableObject,
|
|||||||
{
|
{
|
||||||
ShouldShowContextMenu = false;
|
ShouldShowContextMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnPropertyChanged(nameof(HasSecondaryCommand));
|
||||||
|
OnPropertyChanged(nameof(SecondaryCommand));
|
||||||
|
OnPropertyChanged(nameof(ShouldShowContextMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvokeItemCommand is what this will be in Xaml due to source generator
|
// InvokeItemCommand is what this will be in Xaml due to source generator
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public partial class ContentPageViewModel : PageViewModel, ICommandBarContext
|
|||||||
|
|
||||||
Commands.ForEach(contextItem =>
|
Commands.ForEach(contextItem =>
|
||||||
{
|
{
|
||||||
contextItem.InitializeProperties();
|
contextItem.SlowInitializeProperties();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ public partial class ListViewModel : PageViewModel, IDisposable
|
|||||||
break;
|
break;
|
||||||
case nameof(EmptyContent):
|
case nameof(EmptyContent):
|
||||||
EmptyContent = new(new(model.EmptyContent), PageContext);
|
EmptyContent = new(new(model.EmptyContent), PageContext);
|
||||||
EmptyContent.InitializeProperties();
|
EmptyContent.SlowInitializeProperties();
|
||||||
break;
|
break;
|
||||||
case nameof(IsLoading):
|
case nameof(IsLoading):
|
||||||
UpdateEmptyContent();
|
UpdateEmptyContent();
|
||||||
@@ -454,6 +454,8 @@ public partial class ListViewModel : PageViewModel, IDisposable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateProperty(nameof(EmptyContent));
|
||||||
|
|
||||||
DoOnUiThread(
|
DoOnUiThread(
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user