如何正确设置样式?

时间:2018-07-23 10:43:23

标签: c# wpf

我的按钮首先是这样的:

<Button  Style="{StaticResource MaterialDesignToolForegroundButton}">

但是我不得不为按钮的可见性设置一些样式触发器。 (对于代码,很抱歉,我无法对其进行适当的格式化)。

  <Button.Style>

   <Style x:Name="ButtonVisibility">
       <Setter Property="Button.Visibility" Value="Hidden"/>
         <Style.Triggers>
               <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=IsSelected}" Value="True"/>
                            <Condition Binding="{Binding Path=StatusDrc, Mode=TwoWay}" Value="En attente" />
                     </MultiDataTrigger.Conditions>
       <Setter Property="Button.Visibility" Value="Visible" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=IsMouseOver}" Value="True"/>
                            <Condition Binding="{Binding Path=StatusDrc, Mode=TwoWay}" Value="En attente" />
                </MultiDataTrigger.Conditions>
       <Setter Property="Button.Visibility" Value="Visible" />
                 </MultiDataTrigger>
              </Style.Triggers>
           </Style>

    </Button.Style>

我的问题是如何保留样式触发器,同时使用MaterialDesignToolForegroundButton

0 个答案:

没有答案