title: DataTrigger Binding in WPF Style
body: <p>I have the following Button and Style in WPF and I need to generalize the Binding in the DataTrigger section because I have near 10 similar buttons in the same Window and each button should be binded to a different property (SelectedPositions, SelectedAgencies, ....). Is it possible to implement?</p>
  
  <pre><code>    &lt;Button x:Name="btnPosition"
              Grid.Row="0"
              Grid.Column="0"
              HorizontalAlignment="Left"
              VerticalAlignment="Center"
              Command="{Binding PositionFilterCommand}"
              Content="{l:Translate position}"
              Style="{StaticResource NewButtonStyle}" /&gt;
  
      &lt;Style x:Key="NewButtonStyle" TargetType="{x:Type Button}"&gt;
          &lt;Setter Property="Foreground" Value="White" /&gt;
          &lt;Setter Property="Height" Value="22" /&gt;
          &lt;Setter Property="Width" Value="Auto" /&gt;
          &lt;Setter Property="FontFamily" Value="OpenSans" /&gt;
          &lt;Setter Property="FontSize" Value="13" /&gt;
          &lt;Setter Property="Cursor" Value="Hand" /&gt;
          &lt;Setter Property="Margin" Value="10,2,10,0" /&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="Button"&gt;
                      &lt;Border CornerRadius="3"&gt;
                          &lt;Grid x:Name="gridButton" Background="#54728e"&gt;
                              &lt;Grid.ColumnDefinitions&gt;
                                  &lt;ColumnDefinition Width="Auto" /&gt;
                                  &lt;ColumnDefinition Width="*" /&gt;
                              &lt;/Grid.ColumnDefinitions&gt;
                              &lt;Image x:Name="img"
                                     Grid.Column="0"
                                     Width="24"
                                     Height="24"
                                     Source="Img/tick-white.png"
                                     Visibility="Visible" /&gt;
                              &lt;Rectangle x:Name="rect"
                                         Grid.Column="1"
                                         Fill="#54728e"
                                         RadiusX="3"
                                         RadiusY="3" /&gt;
                              &lt;ContentPresenter Grid.Column="1"
                                                Margin="5,0,5,0"
                                                HorizontalAlignment="Stretch"
                                                VerticalAlignment="Center" /&gt;
                          &lt;/Grid&gt;
                      &lt;/Border&gt;
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;DataTrigger Binding="{Binding SelectedPositions}" Value="{x:Static sys:String.Empty}"&gt;
                              &lt;Setter TargetName="rect" Property="Fill" Value="#8bbcdf" /&gt;
                              &lt;Setter TargetName="img" Property="Visibility" Value="Collapsed" /&gt;
                              &lt;Setter TargetName="gridButton" Property="Background" Value="#8bbcdf" /&gt;
                          &lt;/DataTrigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>