如何在 uwp 中更改弹出窗口的背景颜色? [英] how to change the background color of flyout in uwp?

查看:63
本文介绍了如何在 uwp 中更改弹出窗口的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 c# 或 xaml 中设置菜单弹出背景.

I want to set menu flyout background either in c# or xaml.

我想要这个

<FlyoutBase.AttachedFlyout>             
     <MenuFlyout x:Name="Flyout">
        <MenuFlyout.Items >
           <MenuFlyoutItem Text="Add Expense" Click="AddExpense_Click"/>
           <MenuFlyoutItem Text="Add Friends" Click="AddFriends_Click"/>
        </MenuFlyout.Items>
     </MenuFlyout>
</FlyoutBase.AttachedFlyout>  

...这是我的菜单飞出的 xaml 代码

... And this is my xaml code for menu fly-out

推荐答案

根据您的需求,您可以自定义MenuFlyoutPresenterStyle,如下所示

For your requirement, you could custom MenuFlyoutPresenterStyle like the following

<MenuFlyout x:Name="Flyout">
        <MenuFlyout.MenuFlyoutPresenterStyle>
            <Style TargetType="MenuFlyoutPresenter">
                <Setter Property="Background" Value="Red"/>
            </Style>
        </MenuFlyout.MenuFlyoutPresenterStyle>
        <MenuFlyout.Items >
            <MenuFlyoutItem Text="Add Expense" />
            <MenuFlyoutItem Text="Add Friends" />
        </MenuFlyout.Items>
</MenuFlyout>

这篇关于如何在 uwp 中更改弹出窗口的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆