2017-08-10 79 views
1

我试图使UWP InkToolbar的按钮透明,但更改background属性不会更改控件的颜色,是否有另一种方法可以更改颜色工具栏的按钮?更改InkToolbar的颜色[UWP]

我目前使用的XAML代码是这样的:

<InkToolbar x:Name="inkToolbar" TargetInkCanvas="{x:Bind inkCanvas}" HorizontalAlignment="Center" VerticalAlignment="Top" Background="Transparent"/> 
+0

你是如何设置背景的?如果在代码中,请显示相关的片段。 –

回答

1

最简单的方法是重写主题背景刷在你App.xaml这样

<Application.Resources> 
    <SolidColorBrush x:Key="InkToolbarButtonBackgroundThemeBrush">Transparent</SolidColorBrush> 
</Application.Resources> 

如果你想要更多的控制,您可以包含所有按钮样式为BasedOn的样式。

<Application.Resources> 
    <Style x:Key="InkToolbarCommonButtonStyle" 
      TargetType="ToggleButton"> 
     <Setter Property="MinWidth" 
       Value="{ThemeResource InkToolbarButtonWidth}" /> 
     <Setter Property="MinHeight" 
       Value="{ThemeResource InkToolbarButtonHeight}" /> 
     <Setter Property="MaxWidth" 
       Value="{ThemeResource InkToolbarButtonWidth}" /> 
     <Setter Property="MaxHeight" 
       Value="{ThemeResource InkToolbarButtonHeight}" /> 
     <Setter Property="BorderThickness" 
       Value="0" /> 
     <Setter Property="Background" 
       Value="Transparent" /> 
     <Setter Property="Foreground" 
       Value="{ThemeResource InkToolbarButtonForegroundThemeBrush}" /> 
     <Setter Property="FocusVisualMargin" 
       Value="-3" /> 
    </Style> 
</Application.Resources>