This commit is contained in:
NaBian committed 2020-06-30 00:09:24 +08:00
1 parent 2d9b6bb8ad
commit 148530b91d
14 files changed
+132 -28

No files matched your search

@@ -412,9 +412,6 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\MainMenuControl_16x.png">
<Link>Resources\Img\LeftMainContent\MainMenuControl_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Geometry_16x.png">
<Link>Resources\Img\LeftMainContent\Geometry_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
<Link>Resources\fabric-icons.ttf</Link>
</Resource>
@@ -411,9 +411,6 @@
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\MainMenuControl_16x.png">
<Link>Resources\Img\LeftMainContent\MainMenuControl_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Geometry_16x.png">
<Link>Resources\Img\LeftMainContent\Geometry_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
<Link>Resources\fabric-icons.ttf</Link>
@@ -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>
@@ -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" ]
]
},
{
@@ -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,7 +320,7 @@
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\FrameDemoCtl.xaml.cs">
<DependentUpon>FrameDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml.cs">
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml.cs">
<DependentUpon>GeometryDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
@@ -506,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>
@@ -866,7 +874,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml">
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\GeometryDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -757,6 +757,6 @@
<value>图片选择器</value>
</data>
<data name="Geometry" xml:space="preserve">
<value>Geometry</value>
<value>几何形状</value>
</data>
</root>
@@ -593,7 +593,11 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public string Frame => Lang.Frame;
/// <summary>
/// 查找类似 几何形状 的本地化字符串。
/// </summary>
public string Geometry => Lang.Geometry;
/// <summary>
/// 查找类似 Gif图片 的本地化字符串。
/// </summary>
@@ -1668,6 +1672,9 @@ namespace HandyControlDemo.Properties.Langs
/// </summary>
public static string Frame = nameof(Frame);
/// <summary>
/// 查找类似 几何形状 的本地化字符串。
/// </summary>
public static string Geometry = nameof(Geometry);
/// <summary>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

@@ -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);
}
}
}
@@ -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}">
<hc:TransitioningContentControl>
<WrapPanel Name="panel"/>
<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>
@@ -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<string> _lineSet = new HashSet<string>
{
"CheckedGeometry"
};
public ObservableCollection<GeometryItemModel> GeometryItems { get; set; } =
new ObservableCollection<GeometryItemModel>();
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<string>().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<Geometry>(key);
GeometryItems.Add(new GeometryItemModel
{
Key = key,
Data = data,
Line = _lineSet.Contains(key)
});
}
}
}