Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add ListViewAssist.HeaderRowBackgroundProperty
  • Loading branch information
binarycow committed Aug 7, 2022
commit 94fe09b5478bee275a1a6cd44b2ce0f5e3ea1529
17 changes: 17 additions & 0 deletions MaterialDesignThemes.Wpf/ListViewAssist.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Media;

namespace MaterialDesignThemes.Wpf
{
Expand All @@ -19,5 +20,21 @@ public static Thickness GetListViewItemPadding(DependencyObject element)
{
return (Thickness)element.GetValue(ListViewItemPaddingProperty);
}

public static readonly DependencyProperty HeaderRowBackgroundProperty = DependencyProperty.RegisterAttached(
"HeaderRowBackground",
typeof(Brush),
typeof(ListViewAssist),
new FrameworkPropertyMetadata(default(Brush), FrameworkPropertyMetadataOptions.Inherits));

public static void SetHeaderRowBackground(DependencyObject element, Brush value)
{
element.SetValue(HeaderRowBackgroundProperty, value);
}

public static Brush GetHeaderRowBackground(DependencyObject element)
{
return (Brush)element.GetValue(HeaderRowBackgroundProperty);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
VerticalScrollBarVisibility="Hidden"
wpf:ScrollViewerAssist.SyncHorizontalOffset="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}">
<Border BorderBrush="{DynamicResource MaterialDesignDivider}" BorderThickness="0,0,0,1">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ListViewAssist.HeaderRowBackground)}">
<GridViewHeaderRowPresenter x:Name="PART_GridViewHeaderRowPresenter"
AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
Expand Down Expand Up @@ -193,7 +193,7 @@
</Style.Triggers>
</Style>

<converters:ListViewGridViewConverter
<converters:ListViewGridViewConverter
x:Key="MaterialDesignListViewItemContainerStyleConverter"
DefaultValue="{StaticResource MaterialDesignListBoxItem}"
ViewValue="{StaticResource MaterialDesignGridViewItem}" />
Expand Down