gpt4 book ai didi

c# - 如何在 Windows 10 应用程序中动态更改 Split View背景颜色

转载 作者:太空宇宙 更新时间:2023-11-03 21:17:33 25 4
gpt4 key购买 nike

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<SplitView x:Name="mySplitView" DisplayMode="CompactInline" IsPaneOpen="False"
CompactPaneLength="50" OpenPaneLength="150" Content="{Binding}"> // using PaneBackground I can set color statically
<SplitView.Pane>
<StackPanel>
<Button x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content="&#xE700;"
Width="50" Height="50" Background="Transparent" Foreground="White" Click="HamburgerButton_Click" />
<StackPanel>
</SplitView.Pane>
</SplitView>
</Grid>

。如何动态更改 Splitview Pane 的颜色,即如果用户单击按钮将颜色更改为黄色,它应该更改,如果用户想要默认的强调色,那么应该像在 outlook 邮件应用程序中一样设置。我在一个页面中有我的 Split View,并且想要其他 xaml 页面中的按钮,即设置页面。

最佳答案

您可以使用“PaneBackground”属性作为代码,并在每个项目的单击事件处理程序中使用此代码:

mySplitView.PaneBackground = new SolidColorBrush(Colors.Yellow); 

这是您尝试做的吗?

关于c# - 如何在 Windows 10 应用程序中动态更改 Split View背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33000509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com