Skip to content

Commit 39b1296

Browse files
committed
Improve the performance of merged ResourceDictionaries
1 parent 2a89bf4 commit 39b1296

144 files changed

Lines changed: 679 additions & 503 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Net_40/HandyControl_Net_40/Themes/Styles/Base/ComboBoxBaseStyle.xaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:controls="clr-namespace:HandyControl.Controls"
44
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
5-
xmlns:system="clr-namespace:System;assembly=mscorlib">
5+
xmlns:system="clr-namespace:System;assembly=mscorlib"
6+
xmlns:themes="clr-namespace:HandyControl.Themes">
67

78
<ResourceDictionary.MergedDictionaries>
8-
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
9-
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
10-
<ResourceDictionary Source="../TextBlock.xaml"/>
11-
<ResourceDictionary Source="../Button.xaml"/>
9+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml"/>
10+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Converters.xaml"/>
11+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/TextBlock.xaml"/>
12+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Button.xaml"/>
1213
</ResourceDictionary.MergedDictionaries>
1314

1415
<!--下拉框切换按钮-->

src/Net_40/HandyControl_Net_40/Themes/Styles/Base/TreeViewBaseStyle.xaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:controls="clr-namespace:HandyControl.Controls">
3+
xmlns:controls="clr-namespace:HandyControl.Controls"
4+
xmlns:themes="clr-namespace:HandyControl.Themes">
45

56
<ResourceDictionary.MergedDictionaries>
6-
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
7-
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
8-
<ResourceDictionary Source="BaseStyle.xaml"/>
9-
<ResourceDictionary Source="ScrollViewerBaseStyle.xaml"/>
7+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Sizes.xaml"/>
8+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Converters.xaml"/>
9+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Base/BaseStyle.xaml"/>
10+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Base/ScrollViewerBaseStyle.xaml"/>
1011
</ResourceDictionary.MergedDictionaries>
1112

1213
<PathGeometry x:Key="TreeArrow" Figures="M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z"/>

src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:controls="clr-namespace:HandyControl.Controls"
4-
xmlns:system="clr-namespace:System;assembly=mscorlib">
4+
xmlns:system="clr-namespace:System;assembly=mscorlib"
5+
xmlns:themes="clr-namespace:HandyControl.Themes">
56

67
<ResourceDictionary.MergedDictionaries>
7-
<ResourceDictionary Source="Base/ScrollViewerBaseStyle.xaml"/>
8-
<ResourceDictionary Source="Button.xaml"/>
9-
<ResourceDictionary Source="ToggleButton.xaml"/>
10-
<ResourceDictionary Source="TextBox.xaml"/>
11-
<ResourceDictionary Source="ComboBox.xaml"/>
12-
<ResourceDictionary Source="CheckBox.xaml"/>
8+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Base/ScrollViewerBaseStyle.xaml"/>
9+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Button.xaml"/>
10+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/ToggleButton.xaml"/>
11+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/TextBox.xaml"/>
12+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/ComboBox.xaml"/>
13+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/CheckBox.xaml"/>
1314
</ResourceDictionary.MergedDictionaries>
1415

1516
<Style x:Key="RowHeaderGripperStyle" TargetType="Thumb">

src/Net_40/HandyControl_Net_40/Themes/Styles/ListView.xaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:themes="clr-namespace:HandyControl.Themes">
34

45
<ResourceDictionary.MergedDictionaries>
5-
<ResourceDictionary Source="../Basic/Sizes.xaml"/>
6-
<ResourceDictionary Source="Base/ScrollViewerBaseStyle.xaml"/>
6+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Sizes.xaml"/>
7+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Base/ScrollViewerBaseStyle.xaml"/>
78
</ResourceDictionary.MergedDictionaries>
89

910
<Style x:Key="GridViewColumnHeaderGripper" TargetType="Thumb">

src/Net_40/HandyControl_Net_40/Themes/Styles/MessageBox.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
55
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
66
xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
7-
xmlns:ex="clr-namespace:HandyControl.Tools.Extension">
7+
xmlns:ex="clr-namespace:HandyControl.Tools.Extension"
8+
xmlns:themes="clr-namespace:HandyControl.Themes">
89

910
<ResourceDictionary.MergedDictionaries>
10-
<ResourceDictionary Source="Window.xaml"/>
11+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Window.xaml"/>
1112
</ResourceDictionary.MergedDictionaries>
1213

1314
<Style TargetType="controls:MessageBox" BasedOn="{StaticResource WindowWin10}">

src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
xmlns:controls="clr-namespace:HandyControl.Controls"
44
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
55
xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
6-
xmlns:tools="clr-namespace:HandyControl.Tools">
6+
xmlns:themes="clr-namespace:HandyControl.Themes">
77

88
<ResourceDictionary.MergedDictionaries>
9-
<ResourceDictionary Source="Button.xaml"/>
10-
<ResourceDictionary Source="../Basic/Converters.xaml"/>
11-
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
9+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Button.xaml"/>
10+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Converters.xaml"/>
11+
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml"/>
1212
</ResourceDictionary.MergedDictionaries>
1313

1414
<LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25">

src/Shared/HandyControlDemo_Shared/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Threading;
1111
using System.Windows;
1212
using HandyControl.Data;
13+
using HandyControl.Themes;
1314
using HandyControl.Tools;
1415
using HandyControlDemo.Data;
1516
using HandyControlDemo.Tools;
@@ -72,7 +73,6 @@ protected override void OnStartup(StartupEventArgs e)
7273
UpdateSkin(GlobalData.Config.Skin);
7374
}
7475

75-
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
7676
ConfigHelper.Instance.SetWindowDefaultStyle();
7777
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
7878

@@ -88,6 +88,7 @@ protected override void OnExit(ExitEventArgs e)
8888

8989
internal void UpdateSkin(SkinType skin)
9090
{
91+
SharedResourceDictionary.SharedDictionaries.Clear();
9192
var skins0 = Resources.MergedDictionaries[0];
9293
skins0.MergedDictionaries.Clear();
9394
skins0.MergedDictionaries.Add(ResourceHelper.GetSkin(skin));

src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.ComponentModel;
33
using GalaSoft.MvvmLight.Messaging;
44
using HandyControl.Controls;
5+
using HandyControl.Tools;
56
using HandyControlDemo.Data;
67
using HandyControlDemo.Tools;
78

@@ -18,6 +19,7 @@ protected override void OnInitialized(EventArgs e)
1819
{
1920
base.OnInitialized(e);
2021

22+
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
2123
Messenger.Default.Send(true, MessageToken.FullSwitch);
2224
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
2325
}

src/Shared/HandyControl_Shared/Controls/Input/WatermarkTextBox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace HandyControl.Controls
44
{
5-
internal class WatermarkTextBox : TextBox
5+
public class WatermarkTextBox : TextBox
66
{
77
#region Public Properties
88

src/Shared/HandyControl_Shared/HandyControl_Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ContrastEffect.cs" />
8989
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\EffectBase.cs" />
9090
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\GrayScaleEffect.cs" />
91+
<Compile Include="$(MSBuildThisFileDirectory)Themes\SharedResourceDictionary.cs" />
9192
<Compile Include="$(MSBuildThisFileDirectory)Themes\Theme.cs" />
9293
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
9394
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />

0 commit comments

Comments
 (0)