I've created a TreeViewItem which has a ProgressBar in it.
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Height="35" MinWidth="100">
<CheckBox Name="chk" IsChecked="True" Margin="2" Tag="{Binding}" Style="{DynamicResource myCheckBoxStyle}" />
<TextBlock Text="{Binding}" Padding="0 10 0 10" Width="100" />
<ProgressBar x:Name="tvProgressBar" HorizontalAlignment="Right" Width="300" Height="20" Foreground="#FF089ACE" />
</StackPanel>
</DataTemplate>
But I can not seem to update the value of the progressbar, I can find the progress bar by doing
ProgressBar pb = (System.Windows.Controls.ProgressBar)(tv.HeaderTemplate.LoadContent() as StackPanel).FindName("tvProgressBar");
But when I update the value of the progress bar the UI is not updated. If I create a ProgressBar outside of the TreeView is updates as expected so it seems to be the way I'm either accessing the ProgressBar embedded in the TreeViewItem or the way it needs to be updated.