Merge branch 'master' of https://github.com/HandyOrg/HandyControl into upstream-master
This commit is contained in:
commit
2f34bb72d6
53 files changed
+775
-69
No files matched your search
@@ -63,6 +63,10 @@ Step 4:enjoy coding
|
|||||||
|
|
||||||
## Latest examples
|
## Latest examples
|
||||||
|
|
||||||
|
### HoneycombPanel
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### RunningBlock
|
### RunningBlock
|
||||||
|
|
||||||

|

|
||||||
@@ -81,12 +85,12 @@ Step 4:enjoy coding
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## History publication
|
||||||
|
|
||||||
### ButtonGroup
|
### ButtonGroup
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## History publication
|
|
||||||
|
|
||||||
### Grid
|
### Grid
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 183 KiB |
@@ -2,6 +2,19 @@
|
|||||||
title: DataGrid 数据表格
|
title: DataGrid 数据表格
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 相关样式
|
||||||
|
|
||||||
|
| style名称 | 所属类型 | 用途描述 |
|
||||||
|
| - | - | - |
|
||||||
|
| RowHeaderGripperStyle | Thumb | 行标题拖拽条样式 |
|
||||||
|
| ColumnHeaderGripperStyle | Thumb | 列标题拖拽条样式 |
|
||||||
|
| DataGridCellStyle | DataGridCell | 单元格样式 |
|
||||||
|
| DataGridRowStyle | DataGridRow | 行样式 |
|
||||||
|
| DataGridColumnHeaderStyle | DataGridColumnHeader | 列标题样式 |
|
||||||
|
| DataGridRowHeaderStyle | DataGridRowHeader | 行标题样式 |
|
||||||
|
| TextBlockComboBoxStyle | ComboBox | ComboBox非编辑模式样式 |
|
||||||
|
| DataGridTextColumnStyle | TextBlock | 默认文本样式 |
|
||||||
|
|
||||||
{% note info no-icon %}
|
{% note info no-icon %}
|
||||||
用例:
|
用例:
|
||||||
|
|
||||||
@@ -29,4 +42,35 @@ title: DataGrid 数据表格
|
|||||||
</DataGrid>
|
</DataGrid>
|
||||||
{% endcode %}
|
{% endcode %}
|
||||||

|

|
||||||
{% endnote %}
|
{% endnote %}
|
||||||
|
|
||||||
|
# FAQ
|
||||||
|
{% note warning no-icon%}
|
||||||
|
对于文本显示列`DataGridTextColumn`需要设定文本内容`水平居中`或者`水平居右`,而不是HandyControl中设定的样式默认显示为`居左`时,需要继承`DataGridCellStyle`重写`HorizontalContentAlignment` 属性为`Center` 或`Right` 需要注意的是,此方式仅仅适用于引入了HandControl资源样式的项目,普通原生DataGrid使用该方式无效。
|
||||||
|
|
||||||
|
{% endnote %}
|
||||||
|
|
||||||
|
用例如下:
|
||||||
|
|
||||||
|
{% code %}
|
||||||
|
|
||||||
|
样式:
|
||||||
|
|
||||||
|
<Style x:Key="DataGridTextCenterColumnStyle" TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
xaml中的使用:
|
||||||
|
|
||||||
|
<DataGrid ItemsSource="{Binding Datas}" AutoGenerateColumns="False">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="居左" Binding="{Binding Name}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="居中" CellStyle="{StaticResource DataGridTextCenterColumnStyle}" Width="*" Binding="{Binding Name}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
{% endcode %}
|
||||||
|
|
||||||
|
效果如下:
|
||||||
|
|
||||||
|

|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -396,6 +396,12 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PolygonHexagon_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\PolygonHexagon_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\HandyControl.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\HandyControl.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Dance.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\Dance.png">
|
||||||
<Link>Resources\Img\Dance.png</Link>
|
<Link>Resources\Img\Dance.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -257,6 +257,7 @@
|
|||||||
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
|
<Setter Property="controls:DataGridAttach.ApplyDefaultStyle" Value="True"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="DataGrid">
|
<ControlTemplate TargetType="DataGrid">
|
||||||
|
|||||||
@@ -417,6 +417,12 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\HandyControl.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\HandyControl.png</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PolygonHexagon_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\PolygonHexagon_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -258,6 +258,7 @@
|
|||||||
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
|
<Setter Property="controls:DataGridAttach.ApplyDefaultStyle" Value="True"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="DataGrid">
|
<ControlTemplate TargetType="DataGrid">
|
||||||
|
|||||||
@@ -480,6 +480,12 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\HandyControl.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\HandyControl.png</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PolygonHexagon_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\PolygonHexagon_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Dynamic_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\Dynamic_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -257,6 +257,7 @@
|
|||||||
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingComboBoxColumnStyle" Value="{StaticResource ComboBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.CheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
<Setter Property="controls:DataGridAttach.EditingCheckBoxColumnStyle" Value="{StaticResource CheckBoxBaseStyle}"/>
|
||||||
|
<Setter Property="controls:DataGridAttach.ApplyDefaultStyle" Value="True"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="DataGrid">
|
<ControlTemplate TargetType="DataGrid">
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ using HandyControlDemo.Tools;
|
|||||||
|
|
||||||
namespace HandyControlDemo
|
namespace HandyControlDemo
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// App.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class App
|
public partial class App
|
||||||
{
|
{
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
|||||||
@@ -108,6 +108,10 @@
|
|||||||
|
|
||||||
public static readonly string RunningBlockDemoCtl = nameof(RunningBlockDemoCtl);
|
public static readonly string RunningBlockDemoCtl = nameof(RunningBlockDemoCtl);
|
||||||
|
|
||||||
|
public static readonly string HoneycombPanelDemoCtl = nameof(HoneycombPanelDemoCtl);
|
||||||
|
|
||||||
|
public static readonly string SpriteDemoCtl = nameof(SpriteDemoCtl);
|
||||||
|
|
||||||
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
|
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
|
||||||
|
|
||||||
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
|
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ var controlList = new List<string>
|
|||||||
"CardDemoCtl",
|
"CardDemoCtl",
|
||||||
"MagnifierDemoCtl",
|
"MagnifierDemoCtl",
|
||||||
"ImageBlockDemoCtl",
|
"ImageBlockDemoCtl",
|
||||||
"RunningBlockDemoCtl"
|
"RunningBlockDemoCtl",
|
||||||
|
"HoneycombPanelDemoCtl",
|
||||||
|
"SpriteDemoCtl"
|
||||||
};
|
};
|
||||||
var styleList = new List<string>
|
var styleList = new List<string>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\CardDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\CardDemoCtl.xaml.cs">
|
||||||
<DependentUpon>CardDemoCtl.xaml</DependentUpon>
|
<DependentUpon>CardDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\HoneycombPanelDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>HoneycombPanelDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ImageBlockDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ImageBlockDemoCtl.xaml.cs">
|
||||||
<DependentUpon>ImageBlockDemoCtl.xaml</DependentUpon>
|
<DependentUpon>ImageBlockDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -174,6 +177,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SideMenuDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SideMenuDemoCtl.xaml.cs">
|
||||||
<DependentUpon>SideMenuDemoCtl.xaml</DependentUpon>
|
<DependentUpon>SideMenuDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>SpriteDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\StepBarDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\StepBarDemoCtl.xaml.cs">
|
||||||
<DependentUpon>StepBarDemoCtl.xaml</DependentUpon>
|
<DependentUpon>StepBarDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -322,6 +328,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SideMenuDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SideMenuDemoViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SpriteDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\StepBarDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\StepBarDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\TabControlDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\TabControlDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\WindowDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\WindowDemoViewModel.cs" />
|
||||||
@@ -333,6 +340,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
|
||||||
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
<DependentUpon>AboutWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\AppSprite.xaml.cs">
|
||||||
|
<DependentUpon>AppSprite.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml.cs">
|
||||||
<DependentUpon>BlurWindow.xaml</DependentUpon>
|
<DependentUpon>BlurWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -429,6 +439,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\HoneycombPanelDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ImageBlockDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ImageBlockDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -589,6 +603,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\SpriteDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\StepBarDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\StepBarDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -773,6 +791,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\AppSprite.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
ShowTitle="False"
|
ShowTitle="False"
|
||||||
ResizeMode="CanResizeWithGrip"
|
ResizeMode="CanResizeWithGrip"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
hc:GlobalShortcut.Host="True"
|
|
||||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||||
|
hc:GlobalShortcut.Host="True"
|
||||||
hc:Dialog.Token="{x:Static data:MessageToken.MainWindow}"
|
hc:Dialog.Token="{x:Static data:MessageToken.MainWindow}"
|
||||||
|
hc:WindowAttach.IgnoreAltF4="True"
|
||||||
d:DesignHeight="800"
|
d:DesignHeight="800"
|
||||||
d:DesignWidth="1400"
|
d:DesignWidth="1400"
|
||||||
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
|
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 添加项 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string AddItem {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AddItem", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 动画路径 的本地化字符串。
|
/// 查找类似 动画路径 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -672,6 +681,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 蜂窝布局 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string HoneycombPanel {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("HoneycombPanel", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 混合布局 的本地化字符串。
|
/// 查找类似 混合布局 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -969,6 +987,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 打开精灵 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string OpenSprite {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("OpenSprite", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 轮廓文本 的本地化字符串。
|
/// 查找类似 轮廓文本 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1185,6 +1212,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 删除项 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string RemoveItem {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("RemoveItem", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 重复按钮 的本地化字符串。
|
/// 查找类似 重复按钮 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1338,6 +1374,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 精灵 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string Sprite {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Sprite", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 步骤 的本地化字符串。
|
/// 查找类似 步骤 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -636,4 +636,19 @@
|
|||||||
<data name="RunningBlock" xml:space="preserve">
|
<data name="RunningBlock" xml:space="preserve">
|
||||||
<value>RunningBlock</value>
|
<value>RunningBlock</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="HoneycombPanel" xml:space="preserve">
|
||||||
|
<value>HoneycombPanel</value>
|
||||||
|
</data>
|
||||||
|
<data name="AddItem" xml:space="preserve">
|
||||||
|
<value>Add an item</value>
|
||||||
|
</data>
|
||||||
|
<data name="RemoveItem" xml:space="preserve">
|
||||||
|
<value>Remove an item</value>
|
||||||
|
</data>
|
||||||
|
<data name="Sprite" xml:space="preserve">
|
||||||
|
<value>Sprite</value>
|
||||||
|
</data>
|
||||||
|
<data name="OpenSprite" xml:space="preserve">
|
||||||
|
<value>Open sprite</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -636,4 +636,19 @@
|
|||||||
<data name="RunningBlock" xml:space="preserve">
|
<data name="RunningBlock" xml:space="preserve">
|
||||||
<value>滚动块</value>
|
<value>滚动块</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="HoneycombPanel" xml:space="preserve">
|
||||||
|
<value>蜂窝布局</value>
|
||||||
|
</data>
|
||||||
|
<data name="AddItem" xml:space="preserve">
|
||||||
|
<value>添加项</value>
|
||||||
|
</data>
|
||||||
|
<data name="RemoveItem" xml:space="preserve">
|
||||||
|
<value>删除项</value>
|
||||||
|
</data>
|
||||||
|
<data name="Sprite" xml:space="preserve">
|
||||||
|
<value>精灵</value>
|
||||||
|
</data>
|
||||||
|
<data name="OpenSprite" xml:space="preserve">
|
||||||
|
<value>打开精灵</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 338 B |
@@ -94,4 +94,8 @@
|
|||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="hc:Sprite" BasedOn="{StaticResource {x:Type hc:Sprite}}">
|
||||||
|
<Setter Property="Padding" Value="25"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -157,9 +157,9 @@ namespace HandyControlDemo.Service
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
internal List<CardModel> GetCardDataList()
|
internal ObservableCollection<CardModel> GetCardDataList()
|
||||||
{
|
{
|
||||||
return new List<CardModel>
|
return new ObservableCollection<CardModel>
|
||||||
{
|
{
|
||||||
new CardModel
|
new CardModel
|
||||||
{
|
{
|
||||||
@@ -224,6 +224,14 @@ namespace HandyControlDemo.Service
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal CardModel GetCardData()
|
||||||
|
{
|
||||||
|
return new CardModel
|
||||||
|
{
|
||||||
|
Content = $"/HandyControlDemo;component/Resources/Img/Album/{DateTime.Now.Second % 10 + 1}.jpg"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
internal List<StepBarDemoModel> GetStepBarDemoDataList()
|
||||||
{
|
{
|
||||||
return new List<StepBarDemoModel>
|
return new List<StepBarDemoModel>
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// GrowlDemoGrid.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class GrowlDemoCtl
|
public partial class GrowlDemoCtl
|
||||||
{
|
{
|
||||||
public GrowlDemoCtl()
|
public GrowlDemoCtl()
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.HoneycombPanelDemoCtl"
|
||||||
|
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"
|
||||||
|
DataContext="{Binding CardDemo,Source={StaticResource Locator}}"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:TransitioningContentControl>
|
||||||
|
<Grid Margin="32">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<hc:ButtonGroup Margin="0,0,0,16">
|
||||||
|
<Button Command="{Binding AddItemCmd}" Content="{x:Static langs:Lang.AddItem}"/>
|
||||||
|
<Button Command="{Binding RemoveItemCmd}" Content="{x:Static langs:Lang.RemoveItem}"/>
|
||||||
|
</hc:ButtonGroup>
|
||||||
|
<Border Padding="0" Grid.Row="1" Style="{StaticResource BorderRegion}">
|
||||||
|
<ListBox Background="Transparent" BorderThickness="0" Style="{StaticResource ListBoxCustom}" ItemsSource="{Binding DataList}">
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<hc:HoneycombPanel hc:PanelElement.FluidMoveBehavior="{StaticResource BehaviorXY200}"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="data:CardModel">
|
||||||
|
<hc:Gravatar Style="{StaticResource GravatarCircle}" Margin="10" Source="{Binding Content}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class HoneycombPanelDemoCtl
|
||||||
|
{
|
||||||
|
public HoneycombPanelDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// ImageBrowserDemoCtl.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class ImageBrowserDemoCtl
|
public partial class ImageBrowserDemoCtl
|
||||||
{
|
{
|
||||||
public ImageBrowserDemoCtl()
|
public ImageBrowserDemoCtl()
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.SpriteDemoCtl"
|
||||||
|
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"
|
||||||
|
DataContext="{Binding SpriteDemo,Source={StaticResource Locator}}"
|
||||||
|
Width="300"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:TransitioningContentControl>
|
||||||
|
<Button Margin="32" Command="{Binding OpenCmd}" Content="{x:Static langs:Lang.OpenSprite}"/>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class SpriteDemoCtl
|
||||||
|
{
|
||||||
|
public SpriteDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// StepBarDemoCtl.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class StepBarDemoCtl
|
public partial class StepBarDemoCtl
|
||||||
{
|
{
|
||||||
public StepBarDemoCtl()
|
public StepBarDemoCtl()
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<hc:SimplePanel x:Class="HandyControlDemo.UserControl.AppSprite"
|
||||||
|
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">
|
||||||
|
<Border Background="White" CornerRadius="20" Effect="{StaticResource EffectShadow4}">
|
||||||
|
<Path Width="70" Height="70" Data="{StaticResource LogoGeometry}" Fill="#f06632"/>
|
||||||
|
</Border>
|
||||||
|
<Button Command="hc:ControlCommands.CloseWindow" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Visibility="{Binding IsMouseOver,RelativeSource={RelativeSource AncestorType=hc:SimplePanel},Converter={StaticResource Boolean2VisibilityConverter}}" Width="22" Height="22" Style="{StaticResource ButtonIcon}" Foreground="White" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-8,-8,0"/>
|
||||||
|
</hc:SimplePanel>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class AppSprite
|
||||||
|
{
|
||||||
|
public AppSprite()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/GoToTop_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ButtonGroupDemoCtl}" Content="{x:Static langs:Lang.ButtonGroup}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.ButtonGroupDemoCtl}" Content="{x:Static langs:Lang.ButtonGroup}">
|
||||||
<hc:EdgeElement.LeftContent>
|
<hc:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ButtonGroup_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/Dynamic_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.CardDemoCtl}" Content="{x:Static langs:Lang.Card}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.CardDemoCtl}" Content="{x:Static langs:Lang.Card}">
|
||||||
<hc:EdgeElement.LeftContent>
|
<hc:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/VSO_Card_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/VSO_Card_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
@@ -350,6 +350,11 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/Panel_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/Panel_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.HoneycombPanelDemoCtl}" Content="{x:Static langs:Lang.HoneycombPanel}">
|
||||||
|
<hc:EdgeElement.LeftContent>
|
||||||
|
<Image Source="../../Resources/Img/LeftMainContent/PolygonHexagon_16x.png"/>
|
||||||
|
</hc:EdgeElement.LeftContent>
|
||||||
|
</ListBoxItem>
|
||||||
<ListBoxItem Tag="{x:Static data:MessageToken.CoverViewDemoCtl}" Content="{x:Static langs:Lang.CoverView}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.CoverViewDemoCtl}" Content="{x:Static langs:Lang.CoverView}">
|
||||||
<hc:EdgeElement.LeftContent>
|
<hc:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/DetailDataView_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/DetailDataView_16x.png"/>
|
||||||
@@ -440,6 +445,11 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ScrollBox_16x.png"/>
|
||||||
</hc:EdgeElement.LeftContent>
|
</hc:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.SpriteDemoCtl}" Content="{x:Static langs:Lang.Sprite}">
|
||||||
|
<hc:EdgeElement.LeftContent>
|
||||||
|
<Image Source="../../Resources/Img/LeftMainContent/HandyControl.png"/>
|
||||||
|
</hc:EdgeElement.LeftContent>
|
||||||
|
</ListBoxItem>
|
||||||
<ListBoxItem Tag="{x:Static data:MessageToken.DialogDemoCtl}" Content="{x:Static langs:Lang.Dialog}">
|
<ListBoxItem Tag="{x:Static data:MessageToken.DialogDemoCtl}" Content="{x:Static langs:Lang.Dialog}">
|
||||||
<hc:EdgeElement.LeftContent>
|
<hc:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/Dialog_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/Dialog_16x.png"/>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// ExpanderDemoCtl.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class ExpanderDemoCtl
|
public partial class ExpanderDemoCtl
|
||||||
{
|
{
|
||||||
public ExpanderDemoCtl()
|
public ExpanderDemoCtl()
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// TextBlockDemoCtl.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class TextBlockDemoCtl
|
public partial class TextBlockDemoCtl
|
||||||
{
|
{
|
||||||
public TextBlockDemoCtl()
|
public TextBlockDemoCtl()
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
namespace HandyControlDemo.UserControl
|
namespace HandyControlDemo.UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// ToggleButtonDemoCtl.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class ToggleButtonDemoCtl
|
public partial class ToggleButtonDemoCtl
|
||||||
{
|
{
|
||||||
public ToggleButtonDemoCtl()
|
public ToggleButtonDemoCtl()
|
||||||
|
|||||||
@@ -1,13 +1,34 @@
|
|||||||
using HandyControlDemo.Data;
|
using System;
|
||||||
|
#if netle40
|
||||||
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
#else
|
||||||
|
using GalaSoft.MvvmLight.CommandWpf;
|
||||||
|
#endif
|
||||||
|
using HandyControlDemo.Data;
|
||||||
using HandyControlDemo.Service;
|
using HandyControlDemo.Service;
|
||||||
|
|
||||||
namespace HandyControlDemo.ViewModel
|
namespace HandyControlDemo.ViewModel
|
||||||
{
|
{
|
||||||
public class CardDemoViewModel : DemoViewModelBase<CardModel>
|
public class CardDemoViewModel : DemoViewModelBase<CardModel>
|
||||||
{
|
{
|
||||||
|
private readonly DataService _dataService;
|
||||||
|
|
||||||
public CardDemoViewModel(DataService dataService)
|
public CardDemoViewModel(DataService dataService)
|
||||||
{
|
{
|
||||||
|
_dataService = dataService;
|
||||||
DataList = dataService.GetCardDataList();
|
DataList = dataService.GetCardDataList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RelayCommand AddItemCmd => new Lazy<RelayCommand>(() =>
|
||||||
|
new RelayCommand(() => DataList.Insert(0, _dataService.GetCardData()))).Value;
|
||||||
|
|
||||||
|
public RelayCommand RemoveItemCmd => new Lazy<RelayCommand>(() =>
|
||||||
|
new RelayCommand(() =>
|
||||||
|
{
|
||||||
|
if (DataList.Count > 0)
|
||||||
|
{
|
||||||
|
DataList.RemoveAt(0);
|
||||||
|
}
|
||||||
|
})).Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
using HandyControlDemo.UserControl;
|
||||||
|
#if netle40
|
||||||
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
#else
|
||||||
|
using GalaSoft.MvvmLight.CommandWpf;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
namespace HandyControlDemo
|
||||||
|
{
|
||||||
|
public class SpriteDemoViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public RelayCommand OpenCmd => new Lazy<RelayCommand>(() =>
|
||||||
|
new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
{
|
{
|
||||||
public class MainViewModel : DemoViewModelBase<DemoDataModel>
|
public class MainViewModel : DemoViewModelBase<DemoDataModel>
|
||||||
{
|
{
|
||||||
#region 字段
|
#region 字段
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内容标题
|
/// 内容标题
|
||||||
@@ -33,7 +33,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private ListBoxItem _listBoxItemCurrent;
|
private ListBoxItem _listBoxItemCurrent;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public MainViewModel(DataService dataService)
|
public MainViewModel(DataService dataService)
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
DataList = dataService.GetDemoDataList();
|
DataList = dataService.GetDemoDataList();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 属性
|
#region 属性
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子内容
|
/// 子内容
|
||||||
@@ -84,7 +84,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 命令
|
#region 命令
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 切换例子命令
|
/// 切换例子命令
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
SimpleIoc.Default.Register<TabControlDemoViewModel>();
|
SimpleIoc.Default.Register<TabControlDemoViewModel>();
|
||||||
SimpleIoc.Default.Register<NoUserViewModel>();
|
SimpleIoc.Default.Register<NoUserViewModel>();
|
||||||
SimpleIoc.Default.Register<CardDemoViewModel>();
|
SimpleIoc.Default.Register<CardDemoViewModel>();
|
||||||
|
SimpleIoc.Default.Register<SpriteDemoViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
|
||||||
@@ -88,7 +89,9 @@ namespace HandyControlDemo.ViewModel
|
|||||||
|
|
||||||
public NoUserViewModel NoUser => ServiceLocator.Current.GetInstance<NoUserViewModel>();
|
public NoUserViewModel NoUser => ServiceLocator.Current.GetInstance<NoUserViewModel>();
|
||||||
|
|
||||||
public CardDemoViewModel CardDemo => ServiceLocator.Current.GetInstance<CardDemoViewModel>();
|
public CardDemoViewModel CardDemo => new CardDemoViewModel(ServiceLocator.Current.GetInstance<DataService>());
|
||||||
|
|
||||||
|
public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance<SpriteDemoViewModel>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,44 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
public class DataGridAttach
|
public class DataGridAttach
|
||||||
{
|
{
|
||||||
|
public static readonly DependencyProperty ApplyDefaultStyleProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"ApplyDefaultStyle", typeof(bool), typeof(DataGridAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnApplyDefaultStyleChanged));
|
||||||
|
|
||||||
|
private static void OnApplyDefaultStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var grid = (DataGrid)d;
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
{
|
||||||
|
if (grid.AutoGenerateColumns)
|
||||||
|
{
|
||||||
|
grid.AutoGeneratedColumns += Grid_AutoGeneratedColumns;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateTextColumnStyles(grid);
|
||||||
|
UpdateComboBoxColumnStyles(grid);
|
||||||
|
UpdateCheckBoxColumnStyles(grid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grid.AutoGeneratedColumns -= Grid_AutoGeneratedColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Grid_AutoGeneratedColumns(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
var grid = (DataGrid)sender;
|
||||||
|
UpdateTextColumnStyles(grid);
|
||||||
|
UpdateComboBoxColumnStyles(grid);
|
||||||
|
UpdateCheckBoxColumnStyles(grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetApplyDefaultStyle(DependencyObject element, bool value)
|
||||||
|
=> element.SetValue(ApplyDefaultStyleProperty, value);
|
||||||
|
|
||||||
|
public static bool GetApplyDefaultStyle(DependencyObject element)
|
||||||
|
=> (bool) element.GetValue(ApplyDefaultStyleProperty);
|
||||||
|
|
||||||
public static readonly DependencyProperty TextColumnStyleProperty = DependencyProperty.RegisterAttached(
|
public static readonly DependencyProperty TextColumnStyleProperty = DependencyProperty.RegisterAttached(
|
||||||
"TextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged));
|
"TextColumnStyle", typeof(Style), typeof(DataGridAttach), new PropertyMetadata(default(Style), OnTextColumnStyleChanged));
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using System.Windows;
|
using System;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
|
using HandyControl.Tools.Interop;
|
||||||
|
|
||||||
namespace HandyControl.Controls
|
namespace HandyControl.Controls
|
||||||
{
|
{
|
||||||
@@ -21,7 +24,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if ((bool)e.NewValue)
|
if ((bool)e.NewValue)
|
||||||
{
|
{
|
||||||
ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown; ;
|
ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -37,5 +40,72 @@ namespace HandyControl.Controls
|
|||||||
System.Windows.Window.GetWindow(obj)?.DragMove();
|
System.Windows.Window.GetWindow(obj)?.DragMove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IgnoreAltF4Property = DependencyProperty.RegisterAttached(
|
||||||
|
"IgnoreAltF4", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnIgnoreAltF4Changed));
|
||||||
|
|
||||||
|
private static void OnIgnoreAltF4Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is System.Windows.Window window)
|
||||||
|
{
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
{
|
||||||
|
window.PreviewKeyDown += Window_PreviewKeyDown;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.PreviewKeyDown -= Window_PreviewKeyDown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.System && e.SystemKey == Key.F4)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetIgnoreAltF4(DependencyObject element, bool value)
|
||||||
|
=> element.SetValue(IgnoreAltF4Property, value);
|
||||||
|
|
||||||
|
public static bool GetIgnoreAltF4(DependencyObject element)
|
||||||
|
=> (bool) element.GetValue(IgnoreAltF4Property);
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ShowInTaskManagerProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"ShowInTaskManager", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.TrueBox, OnShowInTaskManagerChanged));
|
||||||
|
|
||||||
|
private static void OnShowInTaskManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is System.Windows.Window window)
|
||||||
|
{
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
{
|
||||||
|
window.SourceInitialized -= Window_SourceInitialized;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.SourceInitialized += Window_SourceInitialized;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Window_SourceInitialized(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is System.Windows.Window window)
|
||||||
|
{
|
||||||
|
var _ = new WindowInteropHelper(window)
|
||||||
|
{
|
||||||
|
Owner = NativeMethods.GetDesktopWindow()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetShowInTaskManager(DependencyObject element, bool value)
|
||||||
|
=> element.SetValue(ShowInTaskManagerProperty, value);
|
||||||
|
|
||||||
|
public static bool GetShowInTaskManager(DependencyObject element)
|
||||||
|
=> (bool) element.GetValue(ShowInTaskManagerProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System.Windows;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Interop;
|
|
||||||
using HandyControl.Tools.Interop;
|
|
||||||
|
|
||||||
namespace HandyControl.Controls
|
namespace HandyControl.Controls
|
||||||
{
|
{
|
||||||
@@ -26,16 +23,6 @@ namespace HandyControl.Controls
|
|||||||
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
|
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSourceInitialized(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnSourceInitialized(e);
|
|
||||||
|
|
||||||
var _ = new WindowInteropHelper(this)
|
|
||||||
{
|
|
||||||
Owner = NativeMethods.GetDesktopWindow()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var desktopWorkingArea = SystemParameters.WorkArea;
|
var desktopWorkingArea = SystemParameters.WorkArea;
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (_textBox != null)
|
if (_textBox != null)
|
||||||
{
|
{
|
||||||
_textBox.TextChanged -= TextBox_TextChanged;
|
TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler);
|
||||||
|
_textBox.TextChanged -= _textBox_TextChanged;
|
||||||
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
|
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
|
||||||
_textBox.LostFocus -= TextBox_LostFocus;
|
_textBox.LostFocus -= TextBox_LostFocus;
|
||||||
}
|
}
|
||||||
@@ -76,13 +77,27 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
if (_textBox != null)
|
if (_textBox != null)
|
||||||
{
|
{
|
||||||
_textBox.TextChanged += TextBox_TextChanged;
|
TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler);
|
||||||
|
_textBox.TextChanged += _textBox_TextChanged;
|
||||||
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
|
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
|
||||||
_textBox.LostFocus += TextBox_LostFocus;
|
_textBox.LostFocus += TextBox_LostFocus;
|
||||||
_textBox.Text = CurrentText;
|
_textBox.Text = CurrentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _textBox_TextChanged(object sender, TextChangedEventArgs e) => UpdateData();
|
||||||
|
|
||||||
|
private void UpdateData()
|
||||||
|
{
|
||||||
|
if (!VerifyData()) return;
|
||||||
|
if (double.TryParse(_textBox.Text, out var value))
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreviewTextInputHandler(object sender, TextCompositionEventArgs e) => UpdateData();
|
||||||
|
|
||||||
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
|
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (IsError) return;
|
if (IsError) return;
|
||||||
@@ -103,15 +118,6 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (!VerifyData()) return;
|
|
||||||
if (double.TryParse(_textBox.Text, out var value))
|
|
||||||
{
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
public sealed class Sprite : System.Windows.Window
|
||||||
|
{
|
||||||
|
private bool _isLeftButtonPressed;
|
||||||
|
|
||||||
|
private double _leftMax;
|
||||||
|
|
||||||
|
private double _topMax;
|
||||||
|
|
||||||
|
private Sprite()
|
||||||
|
{
|
||||||
|
WindowStyle = WindowStyle.None;
|
||||||
|
AllowsTransparency = true;
|
||||||
|
InputManager.Current.PostProcessInput += Current_PostProcessInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Current_PostProcessInput(object sender, ProcessInputEventArgs e)
|
||||||
|
{
|
||||||
|
if (Mouse.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
_isLeftButtonPressed = true;
|
||||||
|
}
|
||||||
|
else if(_isLeftButtonPressed)
|
||||||
|
{
|
||||||
|
if (Left < 0)
|
||||||
|
{
|
||||||
|
Left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Left > _leftMax)
|
||||||
|
{
|
||||||
|
Left = _leftMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Top > _topMax)
|
||||||
|
{
|
||||||
|
Top = _topMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sprite Show(object content)
|
||||||
|
{
|
||||||
|
var sprite = new Sprite
|
||||||
|
{
|
||||||
|
Content = content
|
||||||
|
};
|
||||||
|
|
||||||
|
sprite.Show();
|
||||||
|
|
||||||
|
var desktopWorkingArea = SystemParameters.WorkArea;
|
||||||
|
sprite._leftMax = desktopWorkingArea.Width - sprite.ActualWidth;
|
||||||
|
sprite._topMax = desktopWorkingArea.Height - sprite.ActualHeight;
|
||||||
|
sprite.Left = sprite._leftMax - 50;
|
||||||
|
sprite.Top = 50 - sprite.Padding.Top;
|
||||||
|
|
||||||
|
return sprite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,18 +35,28 @@ namespace HandyControl.Controls
|
|||||||
set => SetValue(OffsetAngleProperty, value);
|
set => SetValue(OffsetAngleProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once RedundantAssignment
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
if (Children.Count == 0) return new Size(Diameter, Diameter);
|
if (Children.Count == 0) return new Size(Diameter, Diameter);
|
||||||
|
|
||||||
availableSize = new Size(Diameter, Diameter);
|
var newSize = new Size(Diameter, Diameter);
|
||||||
|
|
||||||
|
foreach (UIElement element in Children)
|
||||||
|
{
|
||||||
|
element.Measure(newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var perDeg = 360.0 / Children.Count;
|
var perDeg = 360.0 / Children.Count;
|
||||||
var radius = Diameter / 2;
|
var radius = Diameter / 2;
|
||||||
|
|
||||||
foreach (UIElement element in Children)
|
foreach (UIElement element in Children)
|
||||||
{
|
{
|
||||||
element.Measure(availableSize);
|
|
||||||
var centerX = element.DesiredSize.Width / 2.0;
|
var centerX = element.DesiredSize.Width / 2.0;
|
||||||
var centerY = element.DesiredSize.Height / 2.0;
|
var centerY = element.DesiredSize.Height / 2.0;
|
||||||
var angle = perDeg * i++ + OffsetAngle;
|
var angle = perDeg * i++ + OffsetAngle;
|
||||||
@@ -60,11 +70,12 @@ namespace HandyControl.Controls
|
|||||||
var r = Math.PI * angle / 180.0;
|
var r = Math.PI * angle / 180.0;
|
||||||
var x = radius * Math.Cos(r);
|
var x = radius * Math.Cos(r);
|
||||||
var y = radius * Math.Sin(r);
|
var y = radius * Math.Sin(r);
|
||||||
var rectX = x + availableSize.Width / 2 - centerX;
|
var rectX = x + finalSize.Width / 2 - centerX;
|
||||||
var rectY = y + availableSize.Height / 2 - centerY;
|
var rectY = y + finalSize.Height / 2 - centerY;
|
||||||
element.Arrange(new Rect(rectX, rectY, element.DesiredSize.Width, element.DesiredSize.Height));
|
element.Arrange(new Rect(rectX, rectY, element.DesiredSize.Width, element.DesiredSize.Height));
|
||||||
}
|
}
|
||||||
return availableSize;
|
|
||||||
|
return finalSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
public class HoneycombPanel : Panel
|
||||||
|
{
|
||||||
|
private double _unitLength;
|
||||||
|
|
||||||
|
private HoneycombStuffer _stuffer;
|
||||||
|
|
||||||
|
private static int GetXCount(int count)
|
||||||
|
{
|
||||||
|
if (count == 0) return 0;
|
||||||
|
|
||||||
|
count -= 1;
|
||||||
|
|
||||||
|
var index = (int) Math.Floor(Math.Pow((12.0 * count + 25) / 36, 0.5) - 5.0 / 6);
|
||||||
|
var valeIndex = 3 * index * index + 5 * index;
|
||||||
|
var centerValue = valeIndex + 2;
|
||||||
|
|
||||||
|
return count >= centerValue
|
||||||
|
? 4 * index + 6
|
||||||
|
: count > valeIndex
|
||||||
|
? 4 * index + 4
|
||||||
|
: 4 * index + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int GetYCount(int count)
|
||||||
|
{
|
||||||
|
if (count == 0) return 0;
|
||||||
|
|
||||||
|
count -= 1;
|
||||||
|
|
||||||
|
var index = (int)Math.Floor(Math.Pow(count / 3.0 + 0.25, 0.5) - 0.5);
|
||||||
|
var valeIndex = 3 * index * index + 3 * index;
|
||||||
|
|
||||||
|
return count > valeIndex
|
||||||
|
? 2 * index + 2
|
||||||
|
: 2 * index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* layout order
|
||||||
|
*
|
||||||
|
* ● ●
|
||||||
|
* (7) (8)
|
||||||
|
*
|
||||||
|
* ● ● ●
|
||||||
|
* (6) (1) (9)
|
||||||
|
*
|
||||||
|
* ● ● ● ...
|
||||||
|
* (5) (0) (2)
|
||||||
|
*
|
||||||
|
* ● ● ...
|
||||||
|
* (4) (3)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
|
{
|
||||||
|
var maxSize = new Size();
|
||||||
|
|
||||||
|
foreach (UIElement child in InternalChildren)
|
||||||
|
{
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
child.Measure(availableSize);
|
||||||
|
maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width);
|
||||||
|
maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_unitLength = Math.Max(maxSize.Width, maxSize.Height) / 2;
|
||||||
|
|
||||||
|
var xCount = GetXCount(InternalChildren.Count);
|
||||||
|
var yCount = GetYCount(InternalChildren.Count);
|
||||||
|
|
||||||
|
var availableWidth = xCount * _unitLength;
|
||||||
|
var availableHeight = yCount * Math.Pow(3, 0.5) * _unitLength + _unitLength * 2;
|
||||||
|
|
||||||
|
return new Size(availableWidth, availableHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
|
{
|
||||||
|
var childLength = _unitLength * 2;
|
||||||
|
_stuffer = new HoneycombStuffer(new Rect(finalSize.Width / 2 - _unitLength,
|
||||||
|
finalSize.Height / 2 - _unitLength, childLength, childLength));
|
||||||
|
|
||||||
|
foreach (UIElement child in InternalChildren)
|
||||||
|
{
|
||||||
|
child.Arrange(_stuffer.Move());
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class HoneycombStuffer
|
||||||
|
{
|
||||||
|
private int _turns;
|
||||||
|
|
||||||
|
private int _maxIndex;
|
||||||
|
|
||||||
|
private int _currentIndex = -1;
|
||||||
|
|
||||||
|
private readonly double _offsetX;
|
||||||
|
|
||||||
|
private readonly double _offsetY;
|
||||||
|
|
||||||
|
private Rect _childBounds;
|
||||||
|
|
||||||
|
private readonly double[] _offsetXArr;
|
||||||
|
|
||||||
|
private readonly double[] _offsetYArr;
|
||||||
|
|
||||||
|
public HoneycombStuffer(Rect childBounds)
|
||||||
|
{
|
||||||
|
_childBounds = childBounds;
|
||||||
|
_offsetX = childBounds.Width / 2;
|
||||||
|
_offsetY = Math.Pow(3, 0.5) * _offsetX;
|
||||||
|
|
||||||
|
_offsetXArr = new[]
|
||||||
|
{
|
||||||
|
2 * _offsetX,
|
||||||
|
_offsetX,
|
||||||
|
-_offsetX,
|
||||||
|
-2 * _offsetX,
|
||||||
|
-_offsetX,
|
||||||
|
_offsetX
|
||||||
|
};
|
||||||
|
|
||||||
|
_offsetYArr = new[]
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
_offsetY,
|
||||||
|
_offsetY,
|
||||||
|
0,
|
||||||
|
-_offsetY,
|
||||||
|
-_offsetY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect Move()
|
||||||
|
{
|
||||||
|
_currentIndex++;
|
||||||
|
if (_currentIndex > _maxIndex)
|
||||||
|
{
|
||||||
|
_turns++;
|
||||||
|
_maxIndex = _turns * 6 - 1;
|
||||||
|
_currentIndex = 0;
|
||||||
|
_childBounds.Offset(_offsetX, -_offsetY);
|
||||||
|
return _childBounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_turns > 0)
|
||||||
|
{
|
||||||
|
var index = _currentIndex / _turns;
|
||||||
|
_childBounds.Offset(_offsetXArr[index], _offsetYArr[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _childBounds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,11 +24,14 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Magnifier.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ButtonGroup.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ButtonGroup.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Card.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Card.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ToggleBlock.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\ToggleBlock.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\HoneycombPanel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\RunningBlock.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\RunningBlock.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
|
||||||
@@ -761,6 +764,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Sprite.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\StepBar.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\StepBar.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace HandyControl.Interactivity
|
||||||
|
{
|
||||||
|
public class CloseWindowCommand : ICommand
|
||||||
|
{
|
||||||
|
public bool CanExecute(object parameter) => true;
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter is DependencyObject dependencyObject)
|
||||||
|
{
|
||||||
|
if (Window.GetWindow(dependencyObject) is Window window)
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -156,5 +156,10 @@ namespace HandyControl.Interactivity
|
|||||||
/// 前置主窗口
|
/// 前置主窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
|
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 关闭窗口
|
||||||
|
/// </summary>
|
||||||
|
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="../Basic/Converters.xaml"/>
|
<ResourceDictionary Source="../Basic/Converters.xaml"/>
|
||||||
|
<ResourceDictionary Source="../Basic/Sizes.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<!--用于包裹一个区域-->
|
<!--用于包裹一个区域-->
|
||||||
<Style x:Key="BorderRegion" TargetType="Border">
|
<Style x:Key="BorderRegion" TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||||
<Setter Property="Padding" Value="10"/>
|
<Setter Property="Padding" Value="10"/>
|
||||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||||
<Setter Property="BorderThickness" Value="1"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<Style TargetType="controls:GrowlWindow">
|
<Style TargetType="controls:GrowlWindow">
|
||||||
|
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
||||||
|
<Setter Property="controls:WindowAttach.ShowInTaskManager" Value="False"/>
|
||||||
<Setter Property="Width" Value="340"/>
|
<Setter Property="Width" Value="340"/>
|
||||||
<Setter Property="MaxWidth" Value="340"/>
|
<Setter Property="MaxWidth" Value="340"/>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||||
|
|
||||||
|
<Style TargetType="controls:Sprite">
|
||||||
|
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
||||||
|
<Setter Property="controls:WindowAttach.ShowInTaskManager" Value="False"/>
|
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="ShowActivated" Value="False"/>
|
||||||
|
<Setter Property="ShowInTaskbar" Value="False"/>
|
||||||
|
<Setter Property="Topmost" Value="True"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="controls:Sprite">
|
||||||
|
<ContentPresenter Margin="{TemplateBinding Padding}" controls:WindowAttach.IsDragElement="True" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -71,6 +71,7 @@
|
|||||||
<ResourceDictionary Source="Magnifier.xaml"/>
|
<ResourceDictionary Source="Magnifier.xaml"/>
|
||||||
<ResourceDictionary Source="ToggleBlock.xaml"/>
|
<ResourceDictionary Source="ToggleBlock.xaml"/>
|
||||||
<ResourceDictionary Source="RunningBlock.xaml"/>
|
<ResourceDictionary Source="RunningBlock.xaml"/>
|
||||||
|
<ResourceDictionary Source="Sprite.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
Reference in new issue
Block a user