title: Change fontweight on button in WPF treeview
body: <p>I have a templated treeview that is working just as i want, but i have a context menu which allows for a tier 1 node to be marked as "default".</p>
  
  <p>I have a datatrigger which reacts to a property in the viewmodel, which should change the fontweight to bold just to visually show that this is the default node. But the setter will not change the fontweight on the button no matter what!</p>
  
  <p>However if i change another value, like the foreground color for example, it works just fine, font size also no problem.</p>
  
  <p>Why is this, can anyone explain this? Here is some code if needed:</p>
  
  <p>Trigger:</p>
  
  <pre><code>&lt;HierarchicalDataTemplate ItemsSource="{Binding Children,Mode=TwoWay,NotifyOnSourceUpdated=True}"&gt;
      &lt;StackPanel Orientation="Horizontal" VerticalAlignment="Top"&gt;
          &lt;Image x:Name="nodeImg" Source="{Binding Image}" MaxHeight="16" MaxWidth="16"/&gt;
          &lt;Button x:Name="nodeButton" Content="{Binding Name}" Command="{Binding Command}" Style="{StaticResource TreeMenuButton}"/&gt;
      &lt;/StackPanel&gt;
  
      &lt;HierarchicalDataTemplate.Triggers&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem},Path=IsExpanded}" Value="True"&gt;
              &lt;Setter TargetName="nodeImg" Property="Source" Value="{Binding ImageExpanded}"&gt;&lt;/Setter&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding IsDefaultConnection}" Value="True"&gt;
              &lt;Setter TargetName="nodeButton" Property="FontWeight" Value="Bold"&gt;&lt;/Setter&gt;
          &lt;/DataTrigger&gt;
      &lt;/HierarchicalDataTemplate.Triggers&gt;
  &lt;/HierarchicalDataTemplate&gt;
  </code></pre>
  
  <p>Default style on button:</p>
  
  <pre><code>&lt;Style x:Key="TreeMenuButton" TargetType="{x:Type Button}"&gt;
      &lt;Setter Property="SnapsToDevicePixels" Value="true" /&gt;
      &lt;Setter Property="OverridesDefaultStyle" Value="true" /&gt;
      &lt;Setter Property="MinHeight" Value="23" /&gt;
      &lt;Setter Property="MinWidth" Value="75" /&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                  &lt;Border x:Name="Border"
                          CornerRadius="0"
                          BorderThickness="0"
                          Background="Transparent"
                          BorderBrush="Transparent"&gt;
                      &lt;ContentPresenter Margin="2"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Center"
                                        RecognizesAccessKey="True"/&gt;
                  &lt;/Border&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>