Hello, in its own style formed a white square, which in any way can not be removed, after adding Horizontal ScrollBar . How to replace it with a specific color or picture? I read that it is possible to remove it and the window style will be used at that place, but this can lead to irreparable errors.
Perhaps something was missing in the code:
<Style TargetType="{x:Type ScrollBar}"> <Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ScrollBar}"> <Border CornerRadius="4" BorderBrush="Black" BorderThickness="0.25"> <Border.Background> <SolidColorBrush Color="Black" Opacity="0.1"/> </Border.Background> <Grid x:Name="GridScrollBar" Width="8" Background="{TemplateBinding Background}"> <Grid.RowDefinitions> <RowDefinition/> </Grid.RowDefinitions> <Track x:Name="PART_Track" Grid.Row="1" Orientation="Vertical" IsDirectionReversed="True"> <Track.Thumb> <Thumb Style="{DynamicResource ThumbScrollBar}"/> </Track.Thumb> <Track.DecreaseRepeatButton> <RepeatButton x:Name="DecreaseRepeatButton" Command="ScrollBar.PageUpCommand" Style="{DynamicResource RepeatButtonPageScrollBar}"/> </Track.DecreaseRepeatButton> <Track.IncreaseRepeatButton> <RepeatButton x:Name="IncreaseRepeatButton" Command="ScrollBar.PageDownCommand" Style="{DynamicResource RepeatButtonPageScrollBar}"/> </Track.IncreaseRepeatButton> </Track> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="Orientation" Value="Horizontal"> <Setter Property="LayoutTransform" TargetName="GridScrollBar"> <Setter.Value> <RotateTransform Angle="-90"/> </Setter.Value> </Setter> <Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/> <Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeatButton"/> <Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeatButton"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> TreeViewItem
<Border Style="{StaticResource dialog_open_file_border_treeview}"> <TreeView x:Name="treeview_directories" Style="{StaticResource dialog_open_file_treeview}" SelectedItemChanged="treeview_directories_SelectedItemChanged"> <TreeView.Resources> <Style TargetType="{x:Type TreeViewItem}"> <Style.Setters> <Setter Property="Margin" Value="3"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="Foreground" Value="White"/> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Name="img" Width="20" Height="20" Stretch="Fill" Source="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeViewItem}}, Path=Header, Converter={x:Static local:HeaderToImageConverter.Instance}}"/> <TextBlock Text="{Binding}" Margin="5 2 0 0"/> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style.Setters> </Style> </TreeView.Resources> </TreeView> </Border> TreeView
<Style x:Key="dialog_open_file_treeview" TargetType="{x:Type TreeView}"> <Style.Setters> <Setter Property="Margin" Value="4"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="Foreground" Value="Transparent"/> </Style.Setters> </Style> 
TreeViewItem, but theTreeViewitself (StaticResource dialog_open_file_treeview). By the way, did you know that you can put the style forTreeViewin the style resources forTreeView? - VladDTreeView(StaticResource dialog_open_file_treeview), as I understood it, it is not stylized, what do I need to supplement this file with? Yes, but how to do it? - Glayder