<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=""
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/