【问题标题】:Set Menu Flyout background color using c# in windows 8在 windows 8 中使用 c# 设置菜单弹出背景颜色
【发布时间】:2014-07-25 06:12:45
【问题描述】:

我想用 c# 设置菜单弹出背景,因为我在运行时创建弹出,我该怎么做 我用这样的 xaml 知道这一点

<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# 实现这一点?

【问题讨论】:

    标签: c# xaml windows-8.1


    【解决方案1】:

    终于解决了

      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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多