Skip to content

Commit

Permalink
Panel+
Browse files Browse the repository at this point in the history
  • Loading branch information
HeBianGu committed Dec 14, 2023
1 parent 6fa0a3b commit 76e5264
Show file tree
Hide file tree
Showing 18 changed files with 3,058 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Solution/WPF-Control.sln
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Test.Project", "..\Source
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Controls.PrintBox", "..\Source\Controls\H.Controls.PrintBox\H.Controls.PrintBox.csproj", "{D917DF70-86C1-41C4-A8F1-B0BFF091DC26}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "H.Presenters.Design", "..\Source\Presenters\H.Presenters.Design\H.Presenters.Design.csproj", "{2A209B5F-0ED4-4286-B4A9-24265B125C82}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Presenters.Design", "..\Source\Presenters\H.Presenters.Design\H.Presenters.Design.csproj", "{2A209B5F-0ED4-4286-B4A9-24265B125C82}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "H.Test.Design", "..\Source\Tests\H.Test.Design\H.Test.Design.csproj", "{0EC77F0B-A7D3-48E9-811A-EC76298452A7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H.Test.Design", "..\Source\Tests\H.Test.Design\H.Test.Design.csproj", "{0EC77F0B-A7D3-48E9-811A-EC76298452A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "H.Controls.Panel", "..\Source\Controls\H.Controls.Panel\H.Controls.Panel.csproj", "{8634791D-536C-424F-B6D5-8986A4C6EF3B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -659,6 +661,10 @@ Global
{0EC77F0B-A7D3-48E9-811A-EC76298452A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EC77F0B-A7D3-48E9-811A-EC76298452A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EC77F0B-A7D3-48E9-811A-EC76298452A7}.Release|Any CPU.Build.0 = Release|Any CPU
{8634791D-536C-424F-B6D5-8986A4C6EF3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8634791D-536C-424F-B6D5-8986A4C6EF3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8634791D-536C-424F-B6D5-8986A4C6EF3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8634791D-536C-424F-B6D5-8986A4C6EF3B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -770,6 +776,7 @@ Global
{D917DF70-86C1-41C4-A8F1-B0BFF091DC26} = {9E63ED70-6F96-4CB2-8B9D-EAEC77D0548E}
{2A209B5F-0ED4-4286-B4A9-24265B125C82} = {B5FE7036-B316-4FC3-81E8-00BD6C76784D}
{0EC77F0B-A7D3-48E9-811A-EC76298452A7} = {E2C0B11D-5ED5-4F22-8E56-F68982B6E59B}
{8634791D-536C-424F-B6D5-8986A4C6EF3B} = {9E63ED70-6F96-4CB2-8B9D-EAEC77D0548E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DF825C3D-F4F4-4E62-BBFF-B42A5E81112F}
Expand Down
19 changes: 19 additions & 0 deletions Source/Controls/H.Controls.Panel/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2022 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-ControlBase

using System.Windows;
using System.Windows.Markup;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

[assembly: XmlnsDefinition("QQ:908293466", "H.Controls.Panel")]
[assembly: XmlnsPrefix("QQ:908293466", "h")]

[assembly: XmlnsDefinition("https://github.com/HeBianGu", "H.Controls.Panel")]
[assembly: XmlnsPrefix("https://github.com/HeBianGu", "h")]
7 changes: 7 additions & 0 deletions Source/Controls/H.Controls.Panel/DefinitionGrid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright © 2022 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-ControlBase

namespace H.Controls.Panel
{


}
27 changes: 27 additions & 0 deletions Source/Controls/H.Controls.Panel/Extention.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright © 2022 By HeBianGu(QQ:908293466) https://github.com/HeBianGu/WPF-ControlBase

namespace System
{
public static class Extention
{
///// <summary>
///// 注册
///// </summary>
///// <param name="service"></param>
//public static void AddPropertyGrid(this IServiceCollection service)
//{
// service.AddSingleton<IService, Service>();
//}

///// <summary>
///// 配置
///// </summary>
///// <param name="service"></param>
//public static void UseContainPanel(this IApplicationBuilder service, Action<ContainPanelSetting> action)
//{
// action?.Invoke(ContainPanelSetting.Instance);
//}
}


}
5 changes: 5 additions & 0 deletions Source/Controls/H.Controls.Panel/H.Controls.Panel.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<ItemGroup>
<ProjectReference Include="..\..\Providers\H.Providers.Mvvm\H.Providers.Mvvm.csproj" />
</ItemGroup>
</Project>
97 changes: 97 additions & 0 deletions Source/Controls/H.Controls.Panel/HexGrid.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="https://github.com/HeBianGu"
xmlns:local="clr-namespace:H.Controls.Panel"
xmlns:s="clr-namespace:System;assembly=mscorlib">

<local:HexClipConverter x:Key="ClipConverter" />

<Style TargetType="{x:Type local:HexItem}">
<!--<Setter Property="Background" Value="{DynamicResource {x:Static h:BrushKeys.Accent}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static h:BrushKeys.BorderBrush}}" />-->
<Setter Property="BorderThickness" Value="2" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:HexItem">
<Grid Name="hexBorder"
Background="{TemplateBinding BorderBrush}">
<Grid.Clip>
<MultiBinding Converter="{StaticResource ClipConverter}">
<Binding ElementName="hexBorder"
Path="ActualWidth" />
<Binding ElementName="hexBorder"
Path="ActualHeight" />
<Binding Path="Orientation"
RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</Grid.Clip>

<Grid Name="hexContent"
Margin="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}">
<Grid.Clip>
<MultiBinding Converter="{StaticResource ClipConverter}">
<Binding ElementName="hexContent"
Path="ActualWidth" />
<Binding ElementName="hexContent"
Path="ActualHeight" />
<Binding Path="Orientation"
RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</Grid.Clip>

<ContentPresenter Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ClipToBounds="True"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" Value="Gold" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type local:HexList}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<local:HexGrid Background="{Binding Path=Background, RelativeSource={RelativeSource AncestorType=ListBox}}"
ColumnCount="{Binding Path=ColumnCount, RelativeSource={RelativeSource AncestorType=ListBox}}"
RowCount="{Binding Path=RowCount, RelativeSource={RelativeSource AncestorType=ListBox}}" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:HexList}">
<Grid>
<Border Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True">
<ScrollViewer Padding="{TemplateBinding Padding}"
Focusable="False"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Loading

0 comments on commit 76e5264

Please sign in to comment.