It's easiest (and fully supported) if you just do this in code. Using the attached property AttachedFlyout
:
FlyoutBase.SetAttachedFlyout(theGrid,
(MenuFlyout) App.Current.Resources["SecondaryGridFlyout"]);
theGrid
in the example above represents the Grid
you want to change.
<Grid x:Name="theGrid">
<FlyoutBase.AttachedFlyout>
<StaticResource ResourceKey="GridFlyout"/>
</FlyoutBase.AttachedFlyout>
<!-- ... other stuff -->
</Grid>