Gomathi
Gomathi

Reputation: 15

how to change the background color of flyout in uwp?

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

I want like this

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

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

Upvotes: 1

Views: 1762

Answers (2)

Nico Zhu
Nico Zhu

Reputation: 32775

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>

Upvotes: 2

Luca Lindholm
Luca Lindholm

Reputation: 821

You have to change the FlyoutPresenterStyle, I think.

Upvotes: 0

Related Questions