diff --git a/ModernWpf.SampleApp/App.xaml b/ModernWpf.SampleApp/App.xaml index c845443c..4d7dc5c5 100644 --- a/ModernWpf.SampleApp/App.xaml +++ b/ModernWpf.SampleApp/App.xaml @@ -50,42 +50,6 @@ - diff --git a/ModernWpf.SampleApp/MainPage.xaml b/ModernWpf.SampleApp/MainPage.xaml index f60966cf..86fa7442 100644 --- a/ModernWpf.SampleApp/MainPage.xaml +++ b/ModernWpf.SampleApp/MainPage.xaml @@ -62,6 +62,16 @@ + + + + ().FirstOrDefault(); + if (xcr != null) + { + xcr.UseCompactResources = compact; + } + } + } } public class ControlPagesData : List diff --git a/ModernWpf/Controls/XamlControlsResources.cs b/ModernWpf/Controls/XamlControlsResources.cs index e2cd9486..324b7ddb 100644 --- a/ModernWpf/Controls/XamlControlsResources.cs +++ b/ModernWpf/Controls/XamlControlsResources.cs @@ -12,7 +12,42 @@ public class XamlControlsResources : ResourceDictionary /// public XamlControlsResources() { - Source = PackUriHelper.GetAbsoluteUri("XamlControlsResources.xaml"); + MergedDictionaries.Add(new ResourceDictionary { Source = PackUriHelper.GetAbsoluteUri("XamlControlsResources.xaml") }); } + + public bool UseCompactResources + { + get => _useCompactResources; + set + { + if (_useCompactResources != value) + { + _useCompactResources = value; + if (_useCompactResources) + { + MergedDictionaries.Add(CompactResources); + } + else + { + MergedDictionaries.Remove(CompactResources); + }; + } + } + } + + internal static ResourceDictionary CompactResources + { + get + { + if (_compactResources == null) + { + _compactResources = new ResourceDictionary { Source = PackUriHelper.GetAbsoluteUri("DensityStyles/Compact.xaml") }; + } + return _compactResources; + } + } + + private static ResourceDictionary _compactResources; + private bool _useCompactResources; } } diff --git a/ModernWpf/Styles/ListView.xaml b/ModernWpf/Styles/ListView.xaml index a275d803..1f615586 100644 --- a/ModernWpf/Styles/ListView.xaml +++ b/ModernWpf/Styles/ListView.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:ModernWpf.Controls" xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives"> + 40 33 32 diff --git a/ModernWpf/Styles/TreeView.xaml b/ModernWpf/Styles/TreeView.xaml index 5b938e09..2f53471e 100644 --- a/ModernWpf/Styles/TreeView.xaml +++ b/ModernWpf/Styles/TreeView.xaml @@ -2,9 +2,11 @@ + 32 +