Establecer el menú Flyout Fondo Color usando C # en Windows 8
-
21-12-2019 - |
Pregunta
Quiero establecer el menú Fondo de flyout con C # porque estoy creando flyout en tiempo de ejecución, ¿cómo puedo hacer eso? Lo sé con XAML como este
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.ZoomMode" Value="Enabled"/>
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="5"/>
<Setter Property="MinHeight" Value="300"/>
<Setter Property="MinWidth" Value="300"/>
</Style>
</Flyout.FlyoutPresenterStyle>
¿Cómo lograr esto usando C #?
Solución
finalmente resolvió
MenuFlyout m = new MenuFlyout();
Style s = new Windows.UI.Xaml.Style { TargetType = typeof(MenuFlyoutPresenter) };
s.Setters.Add(new Setter(BackgroundProperty,new SolidColorBrush(Colors.Blue)));
MenuFlyoutItem mn = new MenuFlyoutItem();
m.MenuFlyoutPresenterStyle = s;
m.Items.Add(mn);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow