Skip to content

Commit 2d18c26

Browse files
authored
ItemsControl and UserControl for fluent (#10465)
* Added ItemsControl and UserControl xaml files for fluent * Regenerating fluent dictionaries * Making changes to ResourceDictionary of ItemsControl and UserControl * Removing Border.CornerRadius * Regenerating fluent dictionaries * Addressing PR feedback
1 parent 178d2b7 commit 2d18c26

File tree

6 files changed

+121
-1
lines changed

6 files changed

+121
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:system="clr-namespace:System;assembly=System.Runtime">
5+
<Style x:Key="DefaultItemsControlStyle" TargetType="{x:Type ItemsControl}">
6+
<Setter Property="Template">
7+
<Setter.Value>
8+
<ControlTemplate TargetType="{x:Type ItemsControl}">
9+
<Border Background="{TemplateBinding Background}"
10+
BorderBrush="{TemplateBinding BorderBrush}"
11+
BorderThickness="{TemplateBinding BorderThickness}"
12+
Padding="{TemplateBinding Padding}"
13+
SnapsToDevicePixels="true">
14+
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
15+
</Border>
16+
</ControlTemplate>
17+
</Setter.Value>
18+
</Setter>
19+
</Style>
20+
21+
<Style BasedOn="{StaticResource DefaultItemsControlStyle}" TargetType="{x:Type ItemsControl}" />
22+
</ResourceDictionary>

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Label.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
All Rights Reserved.
66
-->
77

8-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
8+
<ResourceDictionary
9+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
10+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
911

1012
<Style x:Key="DefaultLabelStyle" TargetType="{x:Type Label}">
1113
<Setter Property="Padding" Value="0,0,0,4" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:system="clr-namespace:System;assembly=System.Runtime">
5+
<Style x:Key="DefaultUserControlStyle" TargetType="{x:Type UserControl}">
6+
<Setter Property="Template">
7+
<Setter.Value>
8+
<ControlTemplate TargetType="{x:Type UserControl}">
9+
<Border Background="{TemplateBinding Background}"
10+
BorderBrush="{TemplateBinding BorderBrush}"
11+
BorderThickness="{TemplateBinding BorderThickness}"
12+
Padding="{TemplateBinding Padding}"
13+
SnapsToDevicePixels="true">
14+
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
15+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
16+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
17+
</Border>
18+
</ControlTemplate>
19+
</Setter.Value>
20+
</Setter>
21+
</Style>
22+
23+
<Style BasedOn="{StaticResource DefaultUserControlStyle}" TargetType="{x:Type UserControl}" />
24+
</ResourceDictionary>

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,18 @@
26742674
</Setter.Value>
26752675
</Setter>
26762676
</Style>
2677+
<Style x:Key="DefaultItemsControlStyle" TargetType="{x:Type ItemsControl}">
2678+
<Setter Property="Template">
2679+
<Setter.Value>
2680+
<ControlTemplate TargetType="{x:Type ItemsControl}">
2681+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
2682+
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2683+
</Border>
2684+
</ControlTemplate>
2685+
</Setter.Value>
2686+
</Setter>
2687+
</Style>
2688+
<Style BasedOn="{StaticResource DefaultItemsControlStyle}" TargetType="{x:Type ItemsControl}" />
26772689
<Style x:Key="DefaultLabelStyle" TargetType="{x:Type Label}">
26782690
<Setter Property="Padding" Value="0,0,0,4" />
26792691
<Setter Property="Focusable" Value="False" />
@@ -4816,6 +4828,18 @@
48164828
</Style.Triggers>
48174829
</Style>
48184830
<Style BasedOn="{StaticResource DefaultTreeViewItemStyle}" TargetType="{x:Type TreeViewItem}" />
4831+
<Style x:Key="DefaultUserControlStyle" TargetType="{x:Type UserControl}">
4832+
<Setter Property="Template">
4833+
<Setter.Value>
4834+
<ControlTemplate TargetType="{x:Type UserControl}">
4835+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
4836+
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
4837+
</Border>
4838+
</ControlTemplate>
4839+
</Setter.Value>
4840+
</Setter>
4841+
</Style>
4842+
<Style BasedOn="{StaticResource DefaultUserControlStyle}" TargetType="{x:Type UserControl}" />
48194843
<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
48204844
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
48214845
<Grid>

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,18 @@
26552655
</Setter.Value>
26562656
</Setter>
26572657
</Style>
2658+
<Style x:Key="DefaultItemsControlStyle" TargetType="{x:Type ItemsControl}">
2659+
<Setter Property="Template">
2660+
<Setter.Value>
2661+
<ControlTemplate TargetType="{x:Type ItemsControl}">
2662+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
2663+
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2664+
</Border>
2665+
</ControlTemplate>
2666+
</Setter.Value>
2667+
</Setter>
2668+
</Style>
2669+
<Style BasedOn="{StaticResource DefaultItemsControlStyle}" TargetType="{x:Type ItemsControl}" />
26582670
<Style x:Key="DefaultLabelStyle" TargetType="{x:Type Label}">
26592671
<Setter Property="Padding" Value="0,0,0,4" />
26602672
<Setter Property="Focusable" Value="False" />
@@ -4797,6 +4809,18 @@
47974809
</Style.Triggers>
47984810
</Style>
47994811
<Style BasedOn="{StaticResource DefaultTreeViewItemStyle}" TargetType="{x:Type TreeViewItem}" />
4812+
<Style x:Key="DefaultUserControlStyle" TargetType="{x:Type UserControl}">
4813+
<Setter Property="Template">
4814+
<Setter.Value>
4815+
<ControlTemplate TargetType="{x:Type UserControl}">
4816+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
4817+
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
4818+
</Border>
4819+
</ControlTemplate>
4820+
</Setter.Value>
4821+
</Setter>
4822+
</Style>
4823+
<Style BasedOn="{StaticResource DefaultUserControlStyle}" TargetType="{x:Type UserControl}" />
48004824
<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
48014825
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
48024826
<Grid>

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,6 +2671,18 @@
26712671
</Setter.Value>
26722672
</Setter>
26732673
</Style>
2674+
<Style x:Key="DefaultItemsControlStyle" TargetType="{x:Type ItemsControl}">
2675+
<Setter Property="Template">
2676+
<Setter.Value>
2677+
<ControlTemplate TargetType="{x:Type ItemsControl}">
2678+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
2679+
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
2680+
</Border>
2681+
</ControlTemplate>
2682+
</Setter.Value>
2683+
</Setter>
2684+
</Style>
2685+
<Style BasedOn="{StaticResource DefaultItemsControlStyle}" TargetType="{x:Type ItemsControl}" />
26742686
<Style x:Key="DefaultLabelStyle" TargetType="{x:Type Label}">
26752687
<Setter Property="Padding" Value="0,0,0,4" />
26762688
<Setter Property="Focusable" Value="False" />
@@ -4813,6 +4825,18 @@
48134825
</Style.Triggers>
48144826
</Style>
48154827
<Style BasedOn="{StaticResource DefaultTreeViewItemStyle}" TargetType="{x:Type TreeViewItem}" />
4828+
<Style x:Key="DefaultUserControlStyle" TargetType="{x:Type UserControl}">
4829+
<Setter Property="Template">
4830+
<Setter.Value>
4831+
<ControlTemplate TargetType="{x:Type UserControl}">
4832+
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
4833+
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
4834+
</Border>
4835+
</ControlTemplate>
4836+
</Setter.Value>
4837+
</Setter>
4838+
</Style>
4839+
<Style BasedOn="{StaticResource DefaultUserControlStyle}" TargetType="{x:Type UserControl}" />
48164840
<ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}">
48174841
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
48184842
<Grid>

0 commit comments

Comments
 (0)