From 2d9b6bb8ade187df3fd955cfea327c1357ed59c8 Mon Sep 17 00:00:00 2001 From: Mahdi Hosseini Date: Sat, 27 Jun 2020 15:29:14 +0430 Subject: [PATCH 1/2] add #400 --- .../HandyControlDemo_Net_40.csproj | 3 + .../HandyControlDemo_Net_GE45.csproj | 3 + .../Data/DemoInfo.json | 3 +- .../HandyControlDemo_Shared.projitems | 7 + .../Properties/Langs/Lang.Designer.cs | 10 +- .../Properties/Langs/Lang.en.resx | 3 + .../Properties/Langs/Lang.fa.resx | 3 + .../Properties/Langs/Lang.fr.resx | 3 + .../Properties/Langs/Lang.ko-KR.resx | 3 + .../Properties/Langs/Lang.pt-BR.resx | 143 ++++++++++-------- .../Properties/Langs/Lang.resx | 3 + .../Properties/Langs/Lang.ru.resx | 3 + .../Properties/Langs/Lang.tr.resx | 3 + .../Properties/Langs/LangProvider.cs | 6 +- .../Img/LeftMainContent/Geometry_16x.png | Bin 0 -> 470 bytes .../UserControl/Styles/GeometryDemoCtl.xaml | 11 ++ .../Styles/GeometryDemoCtl.xaml.cs | 34 +++++ 17 files changed, 178 insertions(+), 63 deletions(-) create mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj index c17c05bc..5ce52f21 100644 --- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj +++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj @@ -412,6 +412,9 @@ Resources\Img\LeftMainContent\MainMenuControl_16x.png + + Resources\Img\LeftMainContent\Geometry_16x.png + Resources\fabric-icons.ttf diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj index 0a009190..b3896d28 100644 --- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj +++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj @@ -411,6 +411,9 @@ Resources\Img\LeftMainContent\MainMenuControl_16x.png + + + Resources\Img\LeftMainContent\Geometry_16x.png Resources\fabric-icons.ttf diff --git a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json index 3f16bf4a..613c2d5a 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json +++ b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json @@ -32,7 +32,8 @@ [ "Border", "BorderDemoCtl", "BorderElement_16x", "" ], [ "Label", "LabelDemoCtl", "Label_16x", "" ], [ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ], - [ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ] + [ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ], + [ "Geometry", "GeometryDemoCtl", "Geometry_16x", "1" ] ] }, { diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems index 0e17de7f..f32f6c4b 100644 --- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems +++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems @@ -315,6 +315,9 @@ FrameDemoCtl.xaml + + + GeometryDemoCtl.xaml GroupBoxDemoCtl.xaml @@ -862,6 +865,10 @@ Designer MSBuild:Compile + + + Designer + MSBuild:Compile Designer diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs index 41e738c9..7f1a0b46 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs @@ -671,7 +671,15 @@ namespace HandyControlDemo.Properties.Langs { return ResourceManager.GetString("Frame", resourceCulture); } } - + + public static string Geometry + { + get + { + return ResourceManager.GetString("Geometry", resourceCulture); + } + } + /// /// 查找类似 Gif图片 的本地化字符串。 /// diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx index c732de69..090e5b57 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx index 55d816c1..2edb2676 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx index c8d40632..57a16fd2 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx index 145d2134..065145dc 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx index 405807a2..ac7835dc 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx @@ -1,76 +1,96 @@  + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + + + + + + + + + + + + + + + + + + - + + @@ -89,13 +109,13 @@ text/microsoft-resx - 1.3 + 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Sobre @@ -736,4 +756,7 @@ Janela + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx index 1035e112..fc08c26a 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx @@ -756,4 +756,7 @@ 图片选择器 + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx index c732de69..090e5b57 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx index 988e40aa..b641cf03 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx @@ -756,4 +756,7 @@ ImageSelector + + Geometry + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs index 9a7df866..41dba43c 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs @@ -105,6 +105,7 @@ namespace HandyControlDemo.Properties.Langs OnPropertyChanged(nameof(FlowDocumentReader)); OnPropertyChanged(nameof(FlowDocumentScrollViewer)); OnPropertyChanged(nameof(Frame)); + OnPropertyChanged(nameof(Geometry)); OnPropertyChanged(nameof(GifImage)); OnPropertyChanged(nameof(GotoTop)); OnPropertyChanged(nameof(Gravatar)); @@ -592,10 +593,11 @@ namespace HandyControlDemo.Properties.Langs /// public string Frame => Lang.Frame; + public string Geometry => Lang.Geometry; /// /// 查找类似 Gif图片 的本地化字符串。 /// - public string GifImage => Lang.GifImage; + public string GifImage => Lang.GifImage; /// /// 查找类似 回到顶部 的本地化字符串。 @@ -1666,6 +1668,8 @@ namespace HandyControlDemo.Properties.Langs /// public static string Frame = nameof(Frame); + public static string Geometry = nameof(Geometry); + /// /// 查找类似 Gif图片 的本地化字符串。 /// diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png new file mode 100644 index 0000000000000000000000000000000000000000..4075b3dc4cdb21c837e16a81a642b11cd37770ce GIT binary patch literal 470 zcmV;{0V)28P)9j7TypdAgD%_3NRiIohA2T$7hrma~j%IYKT9%ceJ|ToyBTnJNu~=-h zR4QF*KTg{VQmNEBoVe$Cvk2US$8=qvtJmv^WHPA)DScau00a}_2JPu$vG`)!_B;61 zb=@F7gW#s(Q1i_f;O0dkM2^lO(IqzQi9G5!PKCII=M=Zm>}vpS4uS&^mcSYIp!V}X zK1h9^{EQgD`*F2gf~NT|C=?1=$O(o+eDh?rT8*-YJ@PmF5w;ShacQ4`>~yQEgFR+~2r;|_sma+_Bk5L>LHfMT$y zEH4=ck09VMybNx$mQQHzhQr|%20!phBobL|?)8k-kEFckfxi$x0lNT?b9L2oy8r+H M07*qoM6N<$f?;ITrT_o{ literal 0 HcmV?d00001 diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml new file mode 100644 index 00000000..88cf8319 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs new file mode 100644 index 00000000..d2af7c22 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs @@ -0,0 +1,34 @@ + +using HandyControl.Data; +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Shapes; + +namespace HandyControlDemo.UserControl +{ + public partial class GeometryDemoCtl + { + public GeometryDemoCtl() + { + InitializeComponent(); + GenerateGeometries(); + } + + public void GenerateGeometries() + { + ResourceDictionary dictionary = new ResourceDictionary(); + dictionary.Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml", UriKind.Absolute); + foreach (var item in dictionary.Keys) + { + StackPanel stack = new StackPanel { Margin = new Thickness(10) }; + TextBlock text = new TextBlock { Text = item.ToString(), HorizontalAlignment = HorizontalAlignment.Stretch }; + Path path = new Path { Width = 26, Height = 26, Data = TryFindResource(item.ToString()) as Geometry, Fill = TryFindResource(ResourceToken.PrimaryTextBrush) as Brush }; + stack.Children.Add(path); + stack.Children.Add(text); + panel.Children.Add(stack); + } + } + } +} From 148530b91d00e22818d3e15d90bd6a731b7259cc Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Tue, 30 Jun 2020 00:09:24 +0800 Subject: [PATCH 2/2] merge pr --- .../HandyControlDemo_Net_40.csproj | 3 -- .../HandyControlDemo_Net_GE45.csproj | 3 -- .../HandyControlDemo_Code.csproj | 7 +++ .../Data/DemoInfo.json | 2 +- .../Data/Model/GeometryItemModel.cs | 13 ++++++ .../HandyControlDemo_Shared.projitems | 12 ++++- .../Properties/Langs/Lang.resx | 2 +- .../Properties/Langs/LangProvider.cs | 7 +++ .../Img/LeftMainContent/Geometry_16x.png | Bin 470 -> 0 bytes .../Resources/Themes/Styles/Style.xaml | 16 +++++++ .../UserControl/Basic/GeometryItem.xaml | 11 +++++ .../UserControl/Basic/GeometryItem.xaml.cs | 19 ++++++++ .../UserControl/Styles/GeometryDemoCtl.xaml | 23 ++++++++-- .../Styles/GeometryDemoCtl.xaml.cs | 42 +++++++++++------- 14 files changed, 132 insertions(+), 28 deletions(-) create mode 100644 src/Shared/HandyControlDemo_Shared/Data/Model/GeometryItemModel.cs delete mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml.cs diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj index 5ce52f21..c17c05bc 100644 --- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj +++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj @@ -412,9 +412,6 @@ Resources\Img\LeftMainContent\MainMenuControl_16x.png - - Resources\Img\LeftMainContent\Geometry_16x.png - Resources\fabric-icons.ttf diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj index b3896d28..0a009190 100644 --- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj +++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj @@ -411,9 +411,6 @@ Resources\Img\LeftMainContent\MainMenuControl_16x.png - - - Resources\Img\LeftMainContent\Geometry_16x.png Resources\fabric-icons.ttf diff --git a/src/Shared/HandyControlDemo_Code/HandyControlDemo_Code.csproj b/src/Shared/HandyControlDemo_Code/HandyControlDemo_Code.csproj index dbbb46a4..6181daab 100644 --- a/src/Shared/HandyControlDemo_Code/HandyControlDemo_Code.csproj +++ b/src/Shared/HandyControlDemo_Code/HandyControlDemo_Code.csproj @@ -273,6 +273,9 @@ UserControl\Styles\FrameDemoCtl.xaml + + UserControl\Styles\GeometryDemoCtl.xaml + UserControl\Styles\GroupBoxDemoCtl.xaml @@ -706,6 +709,10 @@ UserControl\Styles\FrameDemoCtl.xaml.cs FrameDemoCtl.xaml + + UserControl\Styles\GeometryDemoCtl.xaml.cs + GeometryDemoCtl.xaml + UserControl\Styles\GroupBoxDemoCtl.xaml.cs GroupBoxDemoCtl.xaml diff --git a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json index 613c2d5a..c1e8e21e 100644 --- a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json +++ b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json @@ -33,7 +33,7 @@ [ "Label", "LabelDemoCtl", "Label_16x", "" ], [ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ], [ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ], - [ "Geometry", "GeometryDemoCtl", "Geometry_16x", "1" ] + [ "Geometry", "GeometryDemoCtl", "Path_16x", "1" ] ] }, { diff --git a/src/Shared/HandyControlDemo_Shared/Data/Model/GeometryItemModel.cs b/src/Shared/HandyControlDemo_Shared/Data/Model/GeometryItemModel.cs new file mode 100644 index 00000000..dca49b44 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/Data/Model/GeometryItemModel.cs @@ -0,0 +1,13 @@ +using System.Windows.Media; + +namespace HandyControlDemo.Data +{ + public class GeometryItemModel + { + public Geometry Data { get; set; } + + public string Key { get; set; } + + public bool Line { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems index f32f6c4b..1ae0db8c 100644 --- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems +++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems @@ -19,6 +19,7 @@ + @@ -45,6 +46,9 @@ ChatBox.xaml + + GeometryItem.xaml + InteractiveDialog.xaml @@ -316,7 +320,7 @@ FrameDemoCtl.xaml - + GeometryDemoCtl.xaml @@ -506,6 +510,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -866,7 +874,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx index fc08c26a..34a270a9 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx @@ -757,6 +757,6 @@ 图片选择器 - Geometry + 几何形状 \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs index 41dba43c..93ca4c9c 100644 --- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs +++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs @@ -593,7 +593,11 @@ namespace HandyControlDemo.Properties.Langs /// public string Frame => Lang.Frame; + /// + /// 查找类似 几何形状 的本地化字符串。 + /// public string Geometry => Lang.Geometry; + /// /// 查找类似 Gif图片 的本地化字符串。 /// @@ -1668,6 +1672,9 @@ namespace HandyControlDemo.Properties.Langs /// public static string Frame = nameof(Frame); + /// + /// 查找类似 几何形状 的本地化字符串。 + /// public static string Geometry = nameof(Geometry); /// diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/Geometry_16x.png deleted file mode 100644 index 4075b3dc4cdb21c837e16a81a642b11cd37770ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 470 zcmV;{0V)28P)9j7TypdAgD%_3NRiIohA2T$7hrma~j%IYKT9%ceJ|ToyBTnJNu~=-h zR4QF*KTg{VQmNEBoVe$Cvk2US$8=qvtJmv^WHPA)DScau00a}_2JPu$vG`)!_B;61 zb=@F7gW#s(Q1i_f;O0dkM2^lO(IqzQi9G5!PKCII=M=Zm>}vpS4uS&^mcSYIp!V}X zK1h9^{EQgD`*F2gf~NT|C=?1=$O(o+eDh?rT8*-YJ@PmF5w;ShacQ4`>~yQEgFR+~2r;|_sma+_Bk5L>LHfMT$y zEH4=ck09VMybNx$mQQHzhQr|%20!phBobL|?)8k-kEFckfxi$x0lNT?b9L2oy8r+H M07*qoM6N<$f?;ITrT_o{ diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml index d17b720f..c526ea38 100644 --- a/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml +++ b/src/Shared/HandyControlDemo_Shared/Resources/Themes/Styles/Style.xaml @@ -187,4 +187,20 @@ + + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml new file mode 100644 index 00000000..0e7eb744 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml.cs new file mode 100644 index 00000000..63eb3343 --- /dev/null +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Basic/GeometryItem.xaml.cs @@ -0,0 +1,19 @@ +using System.Windows; +using HandyControlDemo.Data; + +namespace HandyControlDemo.UserControl +{ + public partial class GeometryItem + { + public GeometryItem() => InitializeComponent(); + + public static readonly DependencyProperty InfoProperty = DependencyProperty.Register( + "Info", typeof(GeometryItemModel), typeof(GeometryItem), new PropertyMetadata(default(GeometryItemModel))); + + public GeometryItemModel Info + { + get => (GeometryItemModel) GetValue(InfoProperty); + set => SetValue(InfoProperty, value); + } + } +} \ No newline at end of file diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml index 88cf8319..28168ea8 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml @@ -2,10 +2,27 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:hc="https://handyorg.github.io/handycontrol" - xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs" - xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension" + xmlns:userControl="clr-namespace:HandyControlDemo.UserControl" + DataContext="{Binding RelativeSource={RelativeSource Self}}" Background="{DynamicResource RegionBrush}"> - + + + + + + + + + + + + + + + + + + diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs index d2af7c22..a5db3370 100644 --- a/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs +++ b/src/Shared/HandyControlDemo_Shared/UserControl/Styles/GeometryDemoCtl.xaml.cs @@ -1,15 +1,24 @@ - -using HandyControl.Data; -using System; -using System.Windows; -using System.Windows.Controls; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; using System.Windows.Media; -using System.Windows.Shapes; +using HandyControl.Themes; +using HandyControl.Tools; +using HandyControlDemo.Data; namespace HandyControlDemo.UserControl { public partial class GeometryDemoCtl { + private readonly HashSet _lineSet = new HashSet + { + "CheckedGeometry" + }; + + public ObservableCollection GeometryItems { get; set; } = + new ObservableCollection(); + public GeometryDemoCtl() { InitializeComponent(); @@ -18,16 +27,19 @@ namespace HandyControlDemo.UserControl public void GenerateGeometries() { - ResourceDictionary dictionary = new ResourceDictionary(); - dictionary.Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml", UriKind.Absolute); - foreach (var item in dictionary.Keys) + var uri = new Uri("pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml", UriKind.Absolute); + var dic = SharedResourceDictionary.SharedDictionaries[uri]; + var keys = dic.Keys.OfType().OrderBy(item => item); + + foreach (var key in keys) { - StackPanel stack = new StackPanel { Margin = new Thickness(10) }; - TextBlock text = new TextBlock { Text = item.ToString(), HorizontalAlignment = HorizontalAlignment.Stretch }; - Path path = new Path { Width = 26, Height = 26, Data = TryFindResource(item.ToString()) as Geometry, Fill = TryFindResource(ResourceToken.PrimaryTextBrush) as Brush }; - stack.Children.Add(path); - stack.Children.Add(text); - panel.Children.Add(stack); + var data = ResourceHelper.GetResource(key); + GeometryItems.Add(new GeometryItemModel + { + Key = key, + Data = data, + Line = _lineSet.Contains(key) + }); } } }