Merge pull request #423 from HandyOrg/pr/420

Pr/420
This commit is contained in:
NaBian authored and GitHub committed 2020-06-30 00:10:26 +08:00
commit 1e08a45a4e
19 files changed
+282 -63

No files matched your search

@@ -273,6 +273,9 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Styles\FrameDemoCtl.xaml">
<Link>UserControl\Styles\FrameDemoCtl.xaml</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Styles\GeometryDemoCtl.xaml">
<Link>UserControl\Styles\GeometryDemoCtl.xaml</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Styles\GroupBoxDemoCtl.xaml">
<Link>UserControl\Styles\GroupBoxDemoCtl.xaml</Link>
</Resource>
@@ -706,6 +709,10 @@
<Link>UserControl\Styles\FrameDemoCtl.xaml.cs</Link>
<DependentUpon>FrameDemoCtl.xaml</DependentUpon>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Styles\GeometryDemoCtl.xaml.cs">
<Link>UserControl\Styles\GeometryDemoCtl.xaml.cs</Link>
<DependentUpon>GeometryDemoCtl.xaml</DependentUpon>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
<Link>UserControl\Styles\GroupBoxDemoCtl.xaml.cs</Link>
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
@@ -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", "Path_16x", "1" ]
]
},
{
@@ -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; }
}
}
@@ -19,6 +19,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\CardModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\ChatInfoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\AvatarModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\GeometryItemModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\PropertyGridDemoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\CoverViewDemoModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Model\DemoDataModel.cs" />
@@ -45,6 +46,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\ChatBox.xaml.cs">
<DependentUpon>ChatBox.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\GeometryItem.xaml.cs">
<DependentUpon>GeometryItem.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\IFull.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\InteractiveDialog.xaml.cs">
<DependentUpon>InteractiveDialog.xaml</DependentUpon>
@@ -316,6 +320,9 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\FrameDemoCtl.xaml.cs">
<DependentUpon>FrameDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml.cs">
<DependentUpon>GeometryDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
</Compile>
@@ -503,6 +510,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Basic\GeometryItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Basic\InteractiveDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -863,6 +874,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\GroupBoxDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -671,7 +671,15 @@ namespace HandyControlDemo.Properties.Langs {
return ResourceManager.GetString("Frame", resourceCulture);
}
}
public static string Geometry
{
get
{
return ResourceManager.GetString("Geometry", resourceCulture);
}
}
/// <summary>
/// 查找类似 Gif图片 的本地化字符串。
/// </summary>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -1,76 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
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.
-->
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.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@@ -89,13 +109,13 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="About" xml:space="preserve">
<value>Sobre</value>
@@ -736,4 +756,7 @@
<data name="Window" xml:space="preserve">
<value>Janela</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>图片选择器</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>几何形状</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -756,4 +756,7 @@
<data name="ImageSelector" xml:space="preserve">
<value>ImageSelector</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
</data>
</root>
@@ -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,15 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public string Frame => Lang.Frame;
/// <summary>
/// 查找类似 几何形状 的本地化字符串。
/// </summary>
public string Geometry => Lang.Geometry;
/// <summary>
/// 查找类似 Gif图片 的本地化字符串。
/// </summary>
public string GifImage => Lang.GifImage;
public string GifImage => Lang.GifImage;
/// <summary>
/// 查找类似 回到顶部 的本地化字符串。
@@ -1666,6 +1672,11 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public static string Frame = nameof(Frame);
/// <summary>
/// 查找类似 几何形状 的本地化字符串。
/// </summary>
public static string Geometry = nameof(Geometry);
/// <summary>
/// 查找类似 Gif图片 的本地化字符串。
/// </summary>
@@ -187,4 +187,20 @@
</Setter>
</Style>
<Style x:Key="Path4GeometryItem" BasedOn="{StaticResource {x:Type Path}}" TargetType="Path">
<Setter Property="Margin" Value="10"/>
<Setter Property="Data" Value="{Binding Info.Data,RelativeSource={RelativeSource AncestorType=Border}}"/>
<Setter Property="Fill" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Info.Line,RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Fill" Value="{x:Null}"/>
<Setter Property="Stroke" Value="{DynamicResource PrimaryBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
@@ -0,0 +1,11 @@
<Border x:Class="HandyControlDemo.UserControl.GeometryItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Margin="16"
Cursor="Hand"
mc:Ignorable="d"
Style="{StaticResource BorderCircular}" Background="{DynamicResource RegionBrush}" ToolTip="{Binding Info.Key,RelativeSource={RelativeSource Self}}">
<Path Style="{StaticResource Path4GeometryItem}"/>
</Border>
@@ -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);
}
}
}
@@ -0,0 +1,28 @@
<UserControl x:Class="HandyControlDemo.UserControl.GeometryDemoCtl"
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:userControl="clr-namespace:HandyControlDemo.UserControl"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl>
<ListBox Effect="{StaticResource EffectShadow2}" Margin="32" BorderThickness="0" Style="{StaticResource ListBoxCustom}" Background="Transparent" ItemsSource="{Binding GeometryItems}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<hc:HoneycombPanel>
<hc:HoneycombPanel.RenderTransform>
<TransformGroup>
<TranslateTransform X="-32"/>
</TransformGroup>
</hc:HoneycombPanel.RenderTransform>
</hc:HoneycombPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<userControl:GeometryItem Info="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Media;
using HandyControl.Themes;
using HandyControl.Tools;
using HandyControlDemo.Data;
namespace HandyControlDemo.UserControl
{
public partial class GeometryDemoCtl
{
private readonly HashSet<string> _lineSet = new HashSet<string>
{
"CheckedGeometry"
};
public ObservableCollection<GeometryItemModel> GeometryItems { get; set; } =
new ObservableCollection<GeometryItemModel>();
public GeometryDemoCtl()
{
InitializeComponent();
GenerateGeometries();
}
public void GenerateGeometries()
{
var uri = new Uri("pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml", UriKind.Absolute);
var dic = SharedResourceDictionary.SharedDictionaries[uri];
var keys = dic.Keys.OfType<string>().OrderBy(item => item);
foreach (var key in keys)
{
var data = ResourceHelper.GetResource<Geometry>(key);
GeometryItems.Add(new GeometryItemModel
{
Key = key,
Data = data,
Line = _lineSet.Contains(key)
});
}
}
}
}