문제

런타임에 플라이 아웃을 만들기 때문에 메뉴 플라이 아웃 배경을 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 #?

을 사용하여이를 달성하는 방법

도움이 되었습니까?

해결책

마침내 해결되었습니다

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top