Skip to content

Commit 8d698a7

Browse files
committed
2 parents 86db63d + 84c96cc commit 8d698a7

10 files changed

+344
-48
lines changed

MainDemo.Wpf/Domain/MainWindowViewModel.cs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using System.Linq;
2-
using System.Windows.Controls;
3-
using MaterialDesignDemo;
1+
using MaterialDesignDemo;
42
using MaterialDesignDemo.Domain;
53
using MaterialDesignThemes.Wpf;
64
using MaterialDesignThemes.Wpf.Transitions;
5+
using System.Windows.Controls;
76

87
namespace MaterialDesignColors.WpfExample.Domain
98
{
@@ -13,14 +12,14 @@ public MainWindowViewModel()
1312
{
1413
DemoItems = new[]
1514
{
16-
new DemoItem("Home", new Home(),
15+
new DemoItem("Home", new Home(),
1716
new []
1817
{
1918
new DocumentationLink(DocumentationLinkType.Wiki, "https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/wiki", "WIKI"),
2019
DocumentationLink.DemoPageLink<Home>()
2120
}
2221
),
23-
new DemoItem("Palette", new PaletteSelector { DataContext = new PaletteSelectorViewModel() },
22+
new DemoItem("Palette", new PaletteSelector { DataContext = new PaletteSelectorViewModel() },
2423
new []
2524
{
2625
DocumentationLink.WikiLink("Brush-Names", "Brushes"),
@@ -30,7 +29,7 @@ public MainWindowViewModel()
3029
DocumentationLink.DemoPageLink<PaletteSelectorViewModel>("Demo View Model"),
3130
DocumentationLink.ApiLink<PaletteHelper>()
3231
}),
33-
new DemoItem("Buttons & Toggles", new Buttons(),
32+
new DemoItem("Buttons & Toggles", new Buttons(),
3433
new []
3534
{
3635
DocumentationLink.WikiLink("Button-Styles", "Buttons"),
@@ -46,10 +45,10 @@ public MainWindowViewModel()
4645
},
4746
new DemoItem("Fields", new TextFields(),
4847
new []
49-
{
48+
{
5049
DocumentationLink.DemoPageLink<TextFields>(),
5150
DocumentationLink.StyleLink("TextBox"),
52-
DocumentationLink.StyleLink("ComboBox"),
51+
DocumentationLink.StyleLink("ComboBox"),
5352
})
5453
{
5554
VerticalScrollBarVisibilityRequirement = ScrollBarVisibility.Auto
@@ -65,7 +64,7 @@ public MainWindowViewModel()
6564
new DemoItem("Sliders", new Sliders(), new []
6665
{
6766
DocumentationLink.DemoPageLink<Sliders>(),
68-
DocumentationLink.StyleLink("Sliders")
67+
DocumentationLink.StyleLink("Sliders")
6968
}),
7069
new DemoItem("Chips", new Chips(), new []
7170
{
@@ -93,7 +92,7 @@ public MainWindowViewModel()
9392
},
9493
new DemoItem("Icon Pack", new IconPack { DataContext = new IconPackViewModel() },
9594
new []
96-
{
95+
{
9796
DocumentationLink.DemoPageLink<IconPack>("Demo View"),
9897
DocumentationLink.DemoPageLink<IconPackViewModel>("Demo View Model"),
9998
DocumentationLink.ApiLink<PackIcon>()
@@ -109,18 +108,24 @@ public MainWindowViewModel()
109108
{
110109
DocumentationLink.DemoPageLink<Lists>("Demo View"),
111110
DocumentationLink.DemoPageLink<ListsAndGridsViewModel>("Demo View Model"),
112-
DocumentationLink.StyleLink("ListBox")
111+
DocumentationLink.StyleLink("ListBox")
112+
}),
113+
new DemoItem("ListViews", new ListViews { DataContext = new ListsAndGridsViewModel() },
114+
new DocumentationLink[]
115+
{
116+
113117
}),
118+
114119
new DemoItem("Trees", new Trees { DataContext = new TreesViewModel() },
115120
new []
116-
{
121+
{
117122
DocumentationLink.DemoPageLink<Trees>("Demo View"),
118123
DocumentationLink.DemoPageLink<TreesViewModel>("Demo View Model"),
119124
DocumentationLink.StyleLink("TreeView")
120125
}),
121126
new DemoItem("Grids", new Grids { DataContext = new ListsAndGridsViewModel()},
122127
new []
123-
{
128+
{
124129
DocumentationLink.DemoPageLink<Lists>("Demo View"),
125130
DocumentationLink.DemoPageLink<ListsAndGridsViewModel>("Demo View Model"),
126131
DocumentationLink.StyleLink("DataGrid")
@@ -185,7 +190,7 @@ public MainWindowViewModel()
185190
new DemoItem("Shadows", new Shadows(),
186191
new []
187192
{
188-
DocumentationLink.DemoPageLink<Shadows>(),
193+
DocumentationLink.DemoPageLink<Shadows>(),
189194
}),
190195
};
191196
}

MainDemo.Wpf/ListViews.xaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<UserControl x:Class="MaterialDesignDemo.ListViews"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:MaterialDesignDemo">
5+
<Grid Margin="8">
6+
<ListView Grid.Row="0" ItemsSource="{Binding Items1}">
7+
<ListView.View>
8+
<GridView>
9+
<GridViewColumn DisplayMemberBinding="{Binding Code}" Header="Code" />
10+
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="Name" />
11+
<GridViewColumn DisplayMemberBinding="{Binding Description}" Header="Description" />
12+
</GridView>
13+
</ListView.View>
14+
</ListView>
15+
</Grid>
16+
</UserControl>

MainDemo.Wpf/ListViews.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace MaterialDesignDemo
2+
{
3+
public partial class ListViews
4+
{
5+
public ListViews()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}

MainDemo.Wpf/MaterialDesignDemo.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@
140140
<Compile Include="Lists.xaml.cs">
141141
<DependentUpon>Lists.xaml</DependentUpon>
142142
</Compile>
143+
<Compile Include="ListViews.xaml.cs">
144+
<DependentUpon>ListViews.xaml</DependentUpon>
145+
</Compile>
143146
<Compile Include="MenusAndToolBars.xaml.cs">
144147
<DependentUpon>MenusAndToolBars.xaml</DependentUpon>
145148
</Compile>
@@ -275,6 +278,10 @@
275278
<SubType>Designer</SubType>
276279
<Generator>MSBuild:Compile</Generator>
277280
</Page>
281+
<Page Include="ListViews.xaml">
282+
<SubType>Designer</SubType>
283+
<Generator>MSBuild:Compile</Generator>
284+
</Page>
278285
<Page Include="MainWindow.xaml">
279286
<Generator>MSBuild:Compile</Generator>
280287
<SubType>Designer</SubType>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Windows;
2+
3+
namespace MaterialDesignThemes.Wpf
4+
{
5+
public static class ListViewAssist
6+
{
7+
public static readonly DependencyProperty ListViewItemPaddingProperty = DependencyProperty.RegisterAttached(
8+
"ListViewItemPadding",
9+
typeof(Thickness),
10+
typeof(ListViewAssist),
11+
new FrameworkPropertyMetadata(new Thickness(8, 8, 8, 8), FrameworkPropertyMetadataOptions.Inherits));
12+
13+
public static void SetListViewItemPadding(DependencyObject element, Thickness value)
14+
{
15+
element.SetValue(ListViewItemPaddingProperty, value);
16+
}
17+
18+
public static Thickness GetListViewItemPadding(DependencyObject element)
19+
{
20+
return (Thickness)element.GetValue(ListViewItemPaddingProperty);
21+
}
22+
}
23+
}

MaterialDesignThemes.Wpf/MaterialDesignThemes.Wpf.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134
<SubType>Designer</SubType>
135135
<Generator>MSBuild:Compile</Generator>
136136
</Page>
137+
<Page Include="Themes\MaterialDesignTheme.ListView.xaml">
138+
<SubType>Designer</SubType>
139+
<Generator>MSBuild:Compile</Generator>
140+
</Page>
137141
<Page Include="Themes\MaterialDesignTheme.Menu.xaml">
138142
<SubType>Designer</SubType>
139143
<Generator>MSBuild:Compile</Generator>
@@ -246,6 +250,10 @@
246250
<SubType>Designer</SubType>
247251
<Generator>MSBuild:Compile</Generator>
248252
</Page>
253+
<Page Include="Themes\MaterialDesignTheme.Thumb.xaml">
254+
<Generator>MSBuild:Compile</Generator>
255+
<SubType>Designer</SubType>
256+
</Page>
249257
</ItemGroup>
250258
<ItemGroup>
251259
<Compile Include="Badged.cs" />
@@ -309,6 +317,7 @@
309317
<Compile Include="IconType.cs" />
310318
<Compile Include="ISnackbarMessageQueue.cs" />
311319
<Compile Include="ListBoxAssist.cs" />
320+
<Compile Include="ListViewAssist.cs" />
312321
<Compile Include="MessageQueueExtension.cs" />
313322
<Compile Include="PackIconExtension.cs" />
314323
<Compile Include="Palette.cs" />

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.xaml

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.checkbox.xaml" />
99
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml" />
1010
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
11-
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
11+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />
12+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Thumb.xaml" />
1213
</ResourceDictionary.MergedDictionaries>
1314

1415
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
@@ -34,7 +35,6 @@
3435
<Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ComboBox}, ResourceId=MaterialDataGridComboBoxColumnEditingStyle}"
3536
TargetType="{x:Type ComboBox}"
3637
BasedOn="{StaticResource MaterialDesignDataGridComboBox}">
37-
3838
</Style>
3939

4040
<Style x:Key="MaterialDesignDataGridTextColumnEditingStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
@@ -186,20 +186,7 @@
186186
</Trigger>
187187
</Style.Triggers>
188188
</Style>
189-
190-
<Style x:Key="MaterialDesignDataGridColumnHeaderGripper" TargetType="{x:Type Thumb}">
191-
<Setter Property="Width" Value="8"/>
192-
<Setter Property="Background" Value="Transparent"/>
193-
<Setter Property="Cursor" Value="SizeWE"/>
194-
<Setter Property="Template">
195-
<Setter.Value>
196-
<ControlTemplate TargetType="{x:Type Thumb}">
197-
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
198-
</ControlTemplate>
199-
</Setter.Value>
200-
</Setter>
201-
</Style>
202-
189+
203190
<Style x:Key="MaterialDesignDataGridColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
204191
<Setter Property="VerticalContentAlignment" Value="Center"/>
205192
<Setter Property="TextBlock.FontSize" Value="12" />
@@ -234,8 +221,8 @@
234221
Margin="{TemplateBinding Padding}"/>
235222
</StackPanel>
236223
</Border>
237-
<Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignDataGridColumnHeaderGripper}"/>
238-
<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignDataGridColumnHeaderGripper}"/>
224+
<Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignGridColumnHeaderGripper}"/>
225+
<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignGridColumnHeaderGripper}"/>
239226
</Grid>
240227
<ControlTemplate.Triggers>
241228
<Trigger Property="IsMouseOver" Value="True">
@@ -262,19 +249,6 @@
262249
</Setter>
263250
</Style>
264251

265-
<Style x:Key="MaterialDesignDataGridRowHeaderGripper" TargetType="{x:Type Thumb}">
266-
<Setter Property="Height" Value="8"/>
267-
<Setter Property="Background" Value="Transparent"/>
268-
<Setter Property="Cursor" Value="SizeNS"/>
269-
<Setter Property="Template">
270-
<Setter.Value>
271-
<ControlTemplate TargetType="{x:Type Thumb}">
272-
<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
273-
</ControlTemplate>
274-
</Setter.Value>
275-
</Setter>
276-
</Style>
277-
278252
<Style x:Key="MaterialDesignDataGridRowHeader" TargetType="{x:Type DataGridRowHeader}">
279253
<Setter Property="Template">
280254
<Setter.Value>
@@ -286,8 +260,8 @@
286260
<Control SnapsToDevicePixels="false" Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Visibility="{Binding (Validation.HasError), Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>
287261
</StackPanel>
288262
</Border>
289-
<Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource MaterialDesignDataGridRowHeaderGripper}" VerticalAlignment="Top"/>
290-
<Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource MaterialDesignDataGridRowHeaderGripper}" VerticalAlignment="Bottom"/>
263+
<Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource MaterialDesignGridRowHeaderGripper}" VerticalAlignment="Top"/>
264+
<Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource MaterialDesignGridRowHeaderGripper}" VerticalAlignment="Bottom"/>
291265
</Grid>
292266
</ControlTemplate>
293267
</Setter.Value>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolBarTray.xaml" />
3434
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToolTip.xaml" />
3535
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TreeView.xaml" />
36+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Thumb.xaml" />
37+
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ListView.xaml" />
3638
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ValidationErrorTemplate.xaml" />
3739
</ResourceDictionary.MergedDictionaries>
3840
<SolidColorBrush x:Key="MaterialDesignLightBackground" Color="#FFFAFAFA"/>
@@ -42,10 +44,11 @@
4244
<SolidColorBrush x:Key="MaterialDesignDarkSeparatorBackground" Color="#1F000000" />
4345
<SolidColorBrush x:Key="MaterialDesignLightSeparatorBackground" Color="#1FFFFFFF" />
4446
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignRaisedButton}" />
45-
<Style TargetType="{x:Type Calendar}" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" />
47+
<Style TargetType="{x:Type Calendar}" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" />
4648
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}" />
4749
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}" />
4850
<Style TargetType="{x:Type ContextMenu}" BasedOn="{StaticResource MaterialDesignContextMenu}" />
51+
<Style TargetType="{x:Type Thumb}" BasedOn="{StaticResource MaterialDesignThumb}" />
4952
<Style TargetType="{x:Type DataGrid}" BasedOn="{StaticResource MaterialDesignDataGrid}" />
5053
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}" />
5154
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" />
@@ -72,6 +75,8 @@
7275
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}" />
7376
<Style TargetType="{x:Type TreeView}" BasedOn="{StaticResource MaterialDesignTreeView}" />
7477
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource MaterialDesignTreeViewItem}" />
78+
<Style TargetType="{x:Type ListView}" BasedOn="{StaticResource MaterialDesignListView}" />
79+
<Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource MaterialDesignListViewItem}" />
7580
<Style TargetType="{x:Type Menu}" BasedOn="{StaticResource MaterialDesignMenu}" />
7681
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}" />
7782
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}" BasedOn="{StaticResource MaterialDesignSeparator}" />

0 commit comments

Comments
 (0)