I have a grid in the xaml which uses a resource for its attached flyout:
<Grid >
<FlyoutBase.AttachedFlyout>
<StaticResource ResourceKey="GridFlyout"/>
</FlyoutBase.AttachedFlyout>
.. other stuffs
</Grid>
and I have a defined resource in the page:
<Page.Resources>
<MenuFlyout x:Key="GridFlyout">
<MenuFlyoutItem Text="delete"/>
<MenuFlyoutItem Text="like"/>
<MenuFlyoutItem Text="edit"/>
</MenuFlyout>
But in some conditions I want to set the following resource for the above grid:
<Page.Resources>
<MenuFlyout x:Key="SecondaryGridFlyout">
<MenuFlyoutItem Text="like"/>
</MenuFlyout>
How can I do that? thanks
It's easiest (and fully supported) if you just do this in code. Using the attached property
AttachedFlyout
:theGrid
in the example above represents theGrid
you want to change.