Skip to content

Instantly share code, notes, and snippets.

@timheuer
Created July 28, 2023 18:40
Show Gist options
  • Save timheuer/be3049e5e05ebccd4ace4d32e8e6ad55 to your computer and use it in GitHub Desktop.
Save timheuer/be3049e5e05ebccd4ace4d32e8e6ad55 to your computer and use it in GitHub Desktop.
WPF Styling problem
<HierarchicalDataTemplate x:Key="TreeViewRunNodeDataTemplate" ItemsSource="{Binding Jobs}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock VerticalAlignment="Center" FontFamily="{StaticResource CodiconFont}"
Foreground="{Binding Path=Conclusion, Converter={StaticResource ConclusionColorConverter}}"
Text="{Binding Path=Conclusion, Converter={StaticResource ConclusionIconConverter}}"/>
<emoji:TextBlock Text="{Binding DisplayName}" VerticalAlignment="Bottom" Tag="{Binding Url}"/>
</StackPanel>
</HierarchicalDataTemplate>
<TreeView BorderThickness="0" FontWeight="Normal" PreviewMouseWheel="HandlePreviewMouseWheel" x:Name="tvCurrentBranch" ItemTemplate="{StaticResource TreeViewRunNodeDataTemplate}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
<EventSetter Event="MouseDoubleClick" Handler="JobItem_MouseDoubleClick"/>
</Style>
</TreeView.Resources>
</TreeView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment