我的应用程序中有许多按钮,结构为侧面菜单。它们放在RelativePanel
内。如果我给这个RelativePanel
一个背景色,我的按钮就会消失在那个颜色后面。我设法通过修改按钮本身的前景色和背景色来解决这个问题。但是当我将鼠标悬停在它们上面时,问题仍然存在。像这样:
如果我删除背景颜色,则当我将鼠标悬停在按钮上时,按钮的行为会正常。这是我的XAML:
<RelativePanel Name="RelativePanel_SidePanel" Width="200" Background="Black" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignTopWithPanel="True" RelativePanel.AlignBottomWithPanel="True">
<Image Name="Image_Logo" Source="ms-appx:///Assets/Square150x150Logo.png" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignTopWithPanel="True" RelativePanel.AlignRightWithPanel="True" />
<Button Name="Button_Startpage" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="Image_Logo" BorderThickness="0,0,5,0" HorizontalAlignment="Stretch" BorderBrush="#0780BA" Click="Button_Startpage_Click">
<StackPanel>
<SymbolIcon Symbol="Home" FocusVisualPrimaryBrush="White" />
<TextBlock FocusVisualPrimaryBrush="White">Startpagina</TextBlock>
</StackPanel>
<Button.Background>
<SolidColorBrush Color="Black"></SolidColorBrush>
</Button.Background>
<Button.Foreground>
<SolidColorBrush Color="White"></SolidColorBrush>
</Button.Foreground>
</Button>
</RelativePanel>
有关如何解决此问题的任何想法?