Merge pull request #41 from HandyOrg/master

修复白屏 info.Style is null
This commit is contained in:
眾尋 authored and GitHub committed 2019-06-15 10:53:50 +08:00
commit 20248cbf69
86 files changed
+1249 -311

No files matched your search

+5 -20
View File
@@ -1,20 +1,5 @@
DockBoxResearch/bin
DockBoxResearch/obj
src/.vs
src/Core_30/HandyControl_Core_30/bin
src/Core_30/HandyControl_Core_30/obj
src/Core_30/HandyControlDemo_Core_30/bin
src/Core_30/HandyControlDemo_Core_30/obj
src/Net_35/HandyControl_Net_35/bin
src/Net_35/HandyControl_Net_35/obj
src/Net_35/HandyControlDemo_Net_35/bin
src/Net_35/HandyControlDemo_Net_35/obj
src/Net_40/HandyControl_Net_40/bin
src/Net_40/HandyControl_Net_40/obj
src/Net_40/HandyControlDemo_Net_40/bin
src/Net_40/HandyControlDemo_Net_40/obj
src/Net_GE45/HandyControl_Net_GE45/bin
src/Net_GE45/HandyControl_Net_GE45/obj
src/Net_GE45/HandyControlDemo_Net_GE45/bin
src/Net_GE45/HandyControlDemo_Net_GE45/obj
*.user
.vs
*.user
*.xml
[Bb]in/
[Oo]bj/
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.352
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandyControl_VS2019", "HandyControl_VS2019\HandyControl_VS2019.csproj", "{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A7F567D2-5FA3-4E17-A8A8-CDAFC217BFF5}
EndGlobalSection
EndGlobal
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{3F0F7B9E-C150-4FAA-9274-4F6F0A96B8CA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HandyControl_VS2019</RootNamespace>
<AssemblyName>HandyControl_VS2019</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<GeneratePkgDefFile>true</GeneratePkgDefFile>
<UseCodebase>true</UseCodebase>
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
<StartAction>Program</StartAction>
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="HandyControl_VS2019Package.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="ProjectTemplates\WpfApp.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Packages\handycontrol.1.5.5.nupkg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="15.9.3" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.0.2268" />
</ItemGroup>
<ItemGroup>
<Content Include="icon_100_100.png">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="icon_300_300.png">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="License.txt">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,53 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.VisualStudio.Shell;
using Task = System.Threading.Tasks.Task;
namespace HandyControl_VS2019
{
/// <summary>
/// This is the class that implements the package exposed by this assembly.
/// </summary>
/// <remarks>
/// <para>
/// The minimum requirement for a class to be considered a valid package for Visual Studio
/// is to implement the IVsPackage interface and register itself with the shell.
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
/// to do it: it derives from the Package class that provides the implementation of the
/// IVsPackage interface and uses the registration attributes defined in the framework to
/// register itself and its components with the shell. These attributes tell the pkgdef creation
/// utility what data to put into .pkgdef file.
/// </para>
/// <para>
/// To get loaded into VS, the package must be referred by &lt;Asset Type="Microsoft.VisualStudio.VsPackage" ...&gt; in .vsixmanifest file.
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[Guid(PackageGuidString)]
public sealed class HandyControl_VS2019Package : AsyncPackage
{
/// <summary>
/// HandyControl_VS2019Package GUID string.
/// </summary>
public const string PackageGuidString = "157ef242-83b5-47d0-8f2f-e21dc8308151";
#region Package Members
/// <summary>
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio.
/// </summary>
/// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
/// <param name="progress">A provider for progress updates.</param>
/// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
// When initialized asynchronously, the current thread may be a background thread at this point.
// Do any initialization that requires the UI thread after switching to the UI thread.
await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
}
#endregion
}
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018-2019 HandyOrg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,14 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("HandyControl_VS2019")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HandyControl_VS2019")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.5.5")]
[assembly: AssemblyFileVersion("1.5.5")]
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@@ -0,0 +1,30 @@
<?xml version="1.0" ?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="5949c79d-eb43-4033-8b7b-9349d34512c6" Version="1.5.5" Language="en-US" Publisher="HandyOrg" />
<DisplayName>HandyControl for VS2019</DisplayName>
<Description xml:space="preserve">This VSIX Project will help people initialize a HandyControl project.</Description>
<MoreInfo>https://handyorg.github.io/handycontrol</MoreInfo>
<License>License.txt</License>
<GettingStartedGuide>https://handyorg.github.io/handycontrol/quick_start</GettingStartedGuide>
<ReleaseNotes>https://github.com/HandyOrg/HandyControl/releases</ReleaseNotes>
<Icon>icon_100_100.png</Icon>
<PreviewImage>icon_300_300.png</PreviewImage>
<Tags>WPF C# Control</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0, 17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[16.0, 17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[16.0, 17.0)" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.0,)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.Net.ComponentGroup.TargetingPacks.Common" Version="[16.0.28516.191,17.0)" DisplayName=".NET Framework 4 – 4.6 开发工具" />
</Prerequisites>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="File" Path="ProjectTemplates" d:TargetPath="ProjectTemplates\WpfApp.zip" />
</Assets>
</PackageManifest>
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 HandyOrg
Copyright (c) 2018-2019 HandyOrg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+10 -1
View File
@@ -44,7 +44,16 @@ Step 2:Add code in App.xaml as follows:
</ResourceDictionary>
</Application.Resources>
```
Step 3:enjoy coding
Step 3: Add NameSpace:
`xmlns:hc="https://handyorg.github.io/handycontrol"`
Step 4:enjoy coding
## VSIX packages for Visual Studio
| [VS2019](https://marketplace.visualstudio.com/items?itemName=HandyOrg.handycontrolforvs2019) |
| ------------- |
## Overview
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+6 -2
View File
@@ -1,5 +1,9 @@
---
title: 建设中
title: 附加属性
---
建设中
附加属性源码在Controls / Attach文件夹中:
![Attach](images/Attach.png)
以`Element`结尾的类,可以为所有的控件设置一些共有的属性,以`Attach`结尾的类,只能为一种控件设置相关的属性。
@@ -14,5 +14,5 @@ title: 行为
| BehaviorY400 | 流体移动行为,y轴运动,400毫秒结束动画 |
{% note info no-icon %}
用例:`controls:PanelElement.FluidMoveBehavior="{StaticResource BehaviorXY200}"`
用例:`hc:PanelElement.FluidMoveBehavior="{StaticResource BehaviorXY200}"`
{% endnote %}
+8 -5
View File
@@ -4,12 +4,15 @@ title: 欢迎使用HandyControl
HandyControl是一套WPF控件库,它几乎重写了所有原生样式,同时包含50多款额外的控件(正逐步增加)。
# 使用要求
# 要求
- .Net >= 4.0
- OS >= win7
- IDE >= vs2019
- C# >= 7.3
- 使用要求
.Net >= 4.0
OS >= win7
- 编译要求
IDE >= vs2019
C# >= 7.3
# 下载
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

+27 -2
View File
@@ -1,5 +1,30 @@
---
title: 建设中
title: 国际化
---
建设中
# 使用方式
可通过`ConfigHelper.Instance.SetLang(string lang)`指定需要使用的语言包,默认使用zh-cn。
控件库自带的语言包一般为控件库内部使用,但用户也可以通过以下两种方式使用:
- xaml
第一步,引入命名空间:`xmlns:hc="https://handyorg.github.io/handycontrol"`
第二步,使用语言包:`<TextBlock Text="{x:Static hc:Lang.Cancel}"/>`
- C#
`HandyControl.Properties.Langs.Lang.Cancel`
{% note warning %}
控件库不支持动态语言包切换,未来也不会有支持。
{% endnote %}
# 扩展
控件库自带zh-cn和en两份语言包,默认为zh-cn:
![Langs](images/Langs.png)
如果需要可自行扩展,这里推荐使用开源插件:[ResXManager](https://marketplace.visualstudio.com/items?itemName=TomEnglert.ResXManager),来维护所有的语言包。
引用控件库后,会在运行目录生成语言包文件夹,其命名方式形如zh-cn、en等。
@@ -4,16 +4,40 @@ title: ComboBox 组合框
# ComboBoxBaseStyle
原生组合框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
原生组合框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。原生组合框如果未设置任何样式,则默认使用该样式:
- 默认样式
`<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0"/>`
![ComboBoxBaseStyle](../images/ComboBoxBaseStyle.png)
# ComboBoxExtendBaseStyle : ComboBoxBaseStyle
原生组合框扩展默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
# ComboBoxPlusBaseStyle : ComboBoxExtendBaseStyle
扩展组合框默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
# ComboBoxExtend : ComboBoxExtendBaseStyle
相对于原生组合框默认样式,它借助于附加属性可以实现标题、水印的功能。
相对于原生组合框默认样式,它借助于附加属性可以实现标题、水印的功能。
- 标题在上
`<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" hc:InfoElement.Title="这是标题" Style="{StaticResource ComboBoxExtend}" Text="正文1"/>`
![ComboBoxExtend_1](../images/ComboBoxExtend_1.png)
- 标题在左
`<ComboBox ItemsSource="{Binding DataList}" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitleAlignment="Left" hc:InfoElement.Title="标题在左侧" Style="{StaticResource ComboBoxExtend}" Text="正文1"/>`
![ComboBoxExtend_2](../images/ComboBoxExtend_2.png)
{% note warning %}
标题在左时,为了多个输入框左侧对齐,需要设置标题宽度,标题宽度无需逐个设置,可在外部容器上统一设置。
{% endnote %}
- 标题在上,带有水印
`<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="请输入内容" hc:InfoElement.Title="此项必填" Style="{StaticResource ComboBoxExtend}"/>`
![ComboBoxExtend_3](../images/ComboBoxExtend_3.png)
- 标题在上,带有水印,且为必填
`<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="请输入内容" hc:InfoElement.Title="此项必填" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True"/>`
![ComboBoxExtend_4](../images/ComboBoxExtend_4.png)
- 标题在上,带有水印,且为必填,同时自定义必填提示符
`<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="请输入内容" hc:InfoElement.Title="此项必填" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" hc:InfoElement.Symbol="*"/>`
![ComboBoxExtend_5](../images/ComboBoxExtend_5.png)
@@ -1,5 +1,5 @@
---
title: 建设中
title: ContentControl 内容控件
---
建设中
所有的`ContentControl`默认无法获得焦点
@@ -1,5 +1,22 @@
---
title: 建设中
title: ContextMenu 上下文菜单
---
建设中
# ContextMenuBaseStyle
上下文菜单默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
{% note info no-icon %}
用例:
{% code %}
<ContextMenu ItemsSource="{Binding DataList}">
<ContextMenu.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding DataList}">
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</ContextMenu.ItemTemplate>
</ContextMenu>
{% endcode %}
![ContextMenu](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ContextMenu.png)
{% endnote %}
@@ -1,5 +1,32 @@
---
title: 建设中
title: DataGrid 数据表格
---
建设中
{% note info no-icon %}
用例:
{% code %}
<DataGrid HeadersVisibility="All" RowHeaderWidth="60" AutoGenerateColumns="False" ItemsSource="{Binding DataList}">
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}"/>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Width="80" CanUserResize="False" Binding="{Binding Index}" Header="{x:Static langs:Lang.Index}"/>
<DataGridTemplateColumn Width="60" CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding ImgPath}" Width="32" Height="32" Stretch="Uniform"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="1*" Binding="{Binding Name}" Header="{x:Static langs:Lang.Name}"/>
<DataGridCheckBoxColumn Width="100" CanUserResize="False" Binding="{Binding IsSelected}" Header="{x:Static langs:Lang.Selected}"/>
<DataGridComboBoxColumn ItemsSource="{Binding Source={StaticResource DemoTypes}}" Width="100" CanUserResize="False" SelectedValueBinding="{Binding Type}" Header="{x:Static langs:Lang.Type}"/>
<DataGridTextColumn Width="1*" Binding="{Binding Remark}" Header="{x:Static langs:Lang.Remark}"/>
</DataGrid.Columns>
</DataGrid>
{% endcode %}
![ContextMenu](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/DataGrid.png)
{% endnote %}
@@ -1,5 +1,38 @@
---
title: 建设中
title: DatePicker 日期选择器
---
建设中
# DatePickerBaseStyle
原生日期选择器默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。原生日期选择器如果未设置任何样式,则默认使用该样式:
- 默认样式
`<DatePicker SelectedDate="{x:Static system:DateTime.Now}"/>`
![ComboBoxBaseStyle](../images/DatePickerBaseStyle.png)
# DatePickerExtendBaseStyle : DatePickerBaseStyle
原生日期选择器扩展默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
# DatePickerExtend : DatePickerExtendBaseStyle
- 标题在上
`<DatePicker SelectedDate="{x:Static system:DateTime.Now}" Style="{StaticResource DatePickerExtend}" hc:InfoElement.Title="这是标题"/>`
![DatePickerExtend_1](../images/DatePickerExtend_1.png)
- 标题在左
`<DatePicker SelectedDate="{x:Static system:DateTime.Now}" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitleAlignment="Left" Style="{StaticResource DatePickerExtend}" hc:InfoElement.Title="标题在左侧"/>`
![DatePickerExtend_2](../images/DatePickerExtend_2.png)
{% note warning %}
标题在左时,为了多个输入框左侧对齐,需要设置标题宽度,标题宽度无需逐个设置,可在外部容器上统一设置。
{% endnote %}
- 标题在上,带有水印
[参见Combobox](../combobox)
- 标题在上,带有水印,且为必填
[参见Combobox](../combobox)
- 标题在上,带有水印,且为必填,同时自定义必填提示符
[参见Combobox](../combobox)
Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,25 @@
---
title: 快速开始
---
# 第一步
下载源码或者以Nuget的方式引用控件库。
源码链接:[HandyControl-Github](https://github.com/HandyOrg/HandyControl)
Nuget链接:[HandyControl-Nuget](https://www.nuget.org/packages/HandyControl/)
# 第二步
在App.xaml中添加以下代码:
``` xml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
```
# 第三步
添加命名空间:`xmlns:hc="https://handyorg.github.io/handycontrol"`
+1
View File
@@ -161,6 +161,7 @@ menu:
HandyControl:
default: /handycontrol/ ||
鸣谢: /tnx/ ||
快速开始: /quick_start/ ||
# 总览: /overview/ ||
# 规范: /specifications/ ||
基础xaml定义:
@@ -350,9 +350,6 @@
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PaneLayout_16x.png">
<Link>Resources\Img\LeftMainContent\PaneLayout_16x.png</Link>
</Resource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
@@ -84,7 +84,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel Name="ButtonPanel" WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MinimizeWindowCommand" IsTabStop="False" Name="ButtonMin" Height="29" Style="{StaticResource ButtonIcon}" Width="45" controls:IconElement.Geometry="{StaticResource WindowMinGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MaximizeWindowCommand" IsTabStop="False" Name="ButtonMax" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowMaxGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.RestoreWindowCommand" IsTabStop="False" Name="ButtonRestore" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
@@ -110,6 +110,7 @@
<ControlTemplate.Triggers>
<Trigger Property="IsActive" Value="False">
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
<Setter Property="Opacity" Value=".8" TargetName="ButtonPanel"/>
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
+16 -16
View File
@@ -61,7 +61,7 @@ Global
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net47|Any CPU.Build.0 = Debug-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net48|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Debug-Net48|Any CPU.Build.0 = Debug-Net48|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Core30|Any CPU.ActiveCfg = Release-Net48|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Core30|Any CPU.ActiveCfg = Release-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net40|Any CPU.ActiveCfg = Release-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net45|Any CPU.ActiveCfg = Release-Net45|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net45|Any CPU.Build.0 = Release-Net45|Any CPU
@@ -71,24 +71,24 @@ Global
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net47|Any CPU.Build.0 = Release-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net48|Any CPU.ActiveCfg = Release-Net48|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net48|Any CPU.Build.0 = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Core30|Any CPU.ActiveCfg = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net40|Any CPU.ActiveCfg = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Core30|Any CPU.ActiveCfg = Debug-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net40|Any CPU.ActiveCfg = Debug-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.ActiveCfg = Debug-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.Build.0 = Debug-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.ActiveCfg = Debug-Net462|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.Build.0 = Debug-Net462|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.ActiveCfg = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.Build.0 = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net48|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net48|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Core30|Any CPU.ActiveCfg = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Core30|Any CPU.ActiveCfg = Release-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net40|Any CPU.ActiveCfg = Release-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.ActiveCfg = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.Build.0 = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net462|Any CPU.ActiveCfg = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net462|Any CPU.Build.0 = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.ActiveCfg = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.Build.0 = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.ActiveCfg = Release-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net45|Any CPU.Build.0 = Release-Net45|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net462|Any CPU.ActiveCfg = Release-Net462|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net462|Any CPU.Build.0 = Release-Net462|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.ActiveCfg = Release-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net47|Any CPU.Build.0 = Release-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net48|Any CPU.ActiveCfg = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Release-Net48|Any CPU.Build.0 = Release-Net48|Any CPU
{BE4A567D-B6E0-413E-8F64-E1A53B4F9366}.Debug-Core30|Any CPU.ActiveCfg = Debug|Any CPU
+2 -2
View File
@@ -49,8 +49,8 @@ Global
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net47|Any CPU.Build.0 = Release-Net47|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net48|Any CPU.ActiveCfg = Release-Net48|Any CPU
{DC966E3D-BCFF-4652-98CF-070E5494749A}.Release-Net48|Any CPU.Build.0 = Release-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.ActiveCfg = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net45|Any CPU.Build.0 = Debug-Net47|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.ActiveCfg = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net462|Any CPU.Build.0 = Debug-Net48|Any CPU
{9A7B52E6-94BB-4E7E-BB6A-7CF6761B79A7}.Debug-Net47|Any CPU.ActiveCfg = Debug-Net48|Any CPU
@@ -395,9 +395,6 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PaneLayout_16x.png">
<Link>Resources\Img\LeftMainContent\PaneLayout_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
</Resource>
@@ -84,7 +84,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel shell:WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel Name="ButtonPanel" shell:WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="shell:SystemCommands.MinimizeWindowCommand" IsTabStop="False" Name="ButtonMin" Height="29" Style="{StaticResource ButtonIcon}" Width="45" controls:IconElement.Geometry="{StaticResource WindowMinGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="shell:SystemCommands.MaximizeWindowCommand" IsTabStop="False" Name="ButtonMax" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowMaxGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="shell:SystemCommands.RestoreWindowCommand" IsTabStop="False" Name="ButtonRestore" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
@@ -110,6 +110,7 @@
<ControlTemplate.Triggers>
<Trigger Property="IsActive" Value="False">
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
<Setter Property="Opacity" Value=".8" TargetName="ButtonPanel"/>
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
@@ -15,6 +15,29 @@
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-Net45|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-Net462|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug-Net47|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -38,6 +61,26 @@
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net45|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net462|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
@@ -414,9 +457,6 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\PaneLayout_16x.png">
<Link>Resources\Img\LeftMainContent\PaneLayout_16x.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
</Resource>
@@ -13,6 +13,7 @@
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug-Net45|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -161,6 +162,7 @@
<Link>Properties\Langs\Lang.resx</Link>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
@@ -84,7 +84,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel Name="ButtonPanel" WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MinimizeWindowCommand" IsTabStop="False" Name="ButtonMin" Height="29" Style="{StaticResource ButtonIcon}" Width="45" controls:IconElement.Geometry="{StaticResource WindowMinGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MaximizeWindowCommand" IsTabStop="False" Name="ButtonMax" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowMaxGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.RestoreWindowCommand" IsTabStop="False" Name="ButtonRestore" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
@@ -110,6 +110,7 @@
<ControlTemplate.Triggers>
<Trigger Property="IsActive" Value="False">
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
<Setter Property="Opacity" Value=".8" TargetName="ButtonPanel"/>
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
@@ -98,8 +98,6 @@
public static readonly string RangeSliderDemoCtl = nameof(RangeSliderDemoCtl);
public static readonly string RelativePanelDemoCtl = nameof(RelativePanelDemoCtl);
public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl);
public static readonly string RepeatButtonDemoCtl = nameof(RepeatButtonDemoCtl);
@@ -51,8 +51,7 @@ var controlList = new List<string>
"DialogDemoCtl",
"SideMenuDemoCtl",
"GridDemoCtl",
"RangeSliderDemoCtl",
"RelativePanelDemoCtl"
"RangeSliderDemoCtl"
};
var styleList = new List<string>
{
@@ -816,6 +816,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 关 的本地化字符串。
/// </summary>
public static string Off {
get {
return ResourceManager.GetString("Off", resourceCulture);
}
}
/// <summary>
/// 查找类似 确定 的本地化字符串。
/// </summary>
@@ -825,6 +834,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 开 的本地化字符串。
/// </summary>
public static string On {
get {
return ResourceManager.GetString("On", resourceCulture);
}
}
/// <summary>
/// 查找类似 点击打开背景模糊窗口 的本地化字符串。
/// </summary>
@@ -612,4 +612,10 @@
<data name="RelativePanel" xml:space="preserve">
<value>RelativePanel</value>
</data>
<data name="On" xml:space="preserve">
<value>On</value>
</data>
<data name="Off" xml:space="preserve">
<value>Off</value>
</data>
</root>
@@ -612,4 +612,10 @@
<data name="RelativePanel" xml:space="preserve">
<value>相对布局</value>
</data>
<data name="On" xml:space="preserve">
<value>开</value>
</data>
<data name="Off" xml:space="preserve">
<value>关</value>
</data>
</root>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

@@ -19,7 +19,7 @@ namespace HandyControlDemo.Service
for (var i = 1; i <= 20; i++)
{
var dataList = new List<DemoDataModel>();
for (int j = 0; j < 3; j++)
for (var j = 0; j < 3; j++)
{
dataList.Add(new DemoDataModel
{
@@ -325,11 +325,6 @@
<Image Source="../../Resources/Img/LeftMainContent/Panel_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.RelativePanelDemoCtl}" Content="{x:Static langs:Lang.RelativePanel}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/PaneLayout_16x.png"/>
</hc:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.CoverViewDemoCtl}" Content="{x:Static langs:Lang.CoverView}">
<hc:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/DetailDataView_16x.png"/>
@@ -13,7 +13,7 @@
<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" Margin="0,16,0,0" IsEditable="True"/>
<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Style="{StaticResource ComboBoxExtend}" Margin="0,32,0,0" Text="{x:Static langs:Lang.ContentDemoStr}"/>
<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
<ComboBox ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" hc:InfoElement.Symbol="*" Margin="0,16,0,0"/>
<ComboBox ItemsSource="{Binding DataList}" IsEditable="True" SelectedIndex="0" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Style="{StaticResource ComboBoxExtend}" Margin="0,16,0,0" Text="{x:Static langs:Lang.ContentDemoStr}"/>
<ComboBox ItemsSource="{Binding DataList}" IsEditable="True" hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}" hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr2}" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
@@ -104,6 +104,29 @@
<ToggleButton IsEnabled="False" IsChecked="True" HorizontalAlignment="Center" Margin="5,9" Style="{StaticResource ToggleButtonSwitch}"/>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonSwitch"/>
</StackPanel>
<StackPanel>
<ToggleButton BorderThickness="0" IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.Off}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.On}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</ToggleButton>
<ToggleButton BorderThickness="0" IsEnabled="False" IsChecked="True" Margin="5" HorizontalAlignment="Center" Style="{StaticResource ToggleButtonFlip}">
<hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.Off}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</hc:StatusSwitchElement.CheckedElement>
<Border Background="{DynamicResource DangerBrush}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{x:Static langs:Lang.On}" Foreground="{DynamicResource TextIconBrush}"/>
</Border>
</ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonFlip"/>
</StackPanel>
</WrapPanel>
</StackPanel>
</hc:ScrollViewer>
@@ -1,22 +1,23 @@
<hc:Window x:Class="HandyControlDemo.Window.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Title="{x:Static langs:Lang.About}"
ShowTitle="True"
BorderThickness="1"
BorderBrush="#262e2f"
Style="{StaticResource WindowWin10}"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"
Width="340"
Height="220">
<hc:SimplePanel>
<TextBlock Text="{x:Static hc:Lang.Cancel}" />
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,30,0,0">
<TextBlock Text="HandyControl" FontSize="30" Foreground="{StaticResource PrimaryBrush}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
<TextBlock Text="{Binding Version}" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{StaticResource PrimaryBrush}"/>
@@ -246,7 +246,7 @@ namespace HandyControl.Controls
{
if (show)
{
for (int i = 0; i < itemsCount; i++)
for (var i = 0; i < itemsCount; i++)
{
var row = (DataGridRow)generator.ContainerFromIndex(i);
if (row != null)
@@ -257,7 +257,7 @@ namespace HandyControl.Controls
}
else
{
for (int i = 0; i < itemsCount; i++)
for (var i = 0; i < itemsCount; i++)
{
var row = (DataGridRow)generator.ContainerFromIndex(i);
if (row != null)
@@ -333,7 +333,7 @@ namespace HandyControl.Controls
}
var list = new List<bool>();
for (int i = 0; i < 2; i++)
for (var i = 0; i < 2; i++)
{
list.Add(false);
}
@@ -321,7 +321,7 @@ namespace HandyControl.Controls
try
{
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
guids[i] = (Guid)ExternDllHelper.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid));
}
@@ -36,11 +36,11 @@ namespace HandyControl.Controls
public static readonly DependencyProperty DotCountProperty = DependencyProperty.Register(
"DotCount", typeof(int), typeof(LoadingBase),
new FrameworkPropertyMetadata(5, FrameworkPropertyMetadataOptions.AffectsRender));
new FrameworkPropertyMetadata(ValueBoxes.Int5Box, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DotIntervalProperty = DependencyProperty.Register(
"DotInterval", typeof(double), typeof(LoadingBase),
new FrameworkPropertyMetadata(10.0, FrameworkPropertyMetadataOptions.AffectsRender));
new FrameworkPropertyMetadata(ValueBoxes.Double10Box, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DotBorderBrushProperty = DependencyProperty.Register(
"DotBorderBrush", typeof(Brush), typeof(LoadingBase),
@@ -122,7 +122,7 @@ namespace HandyControl.Controls
StretchProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(Stretch.Uniform,
OnPropertiesChanged));
StrokeThicknessProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(1.0,
StrokeThicknessProperty.AddOwner(typeof(AnimationPath), new FrameworkPropertyMetadata(ValueBoxes.Double1Box,
OnPropertiesChanged));
}
@@ -82,7 +82,7 @@ namespace HandyControl.Controls
/// 最大页数
/// </summary>
public static readonly DependencyProperty MaxPageCountProperty = DependencyProperty.Register(
"MaxPageCount", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
"MaxPageCount", typeof(int), typeof(Pagination), new PropertyMetadata(ValueBoxes.Int1Box, (o, args) =>
{
if (o is Pagination pagination && args.NewValue is int value)
{
@@ -156,7 +156,7 @@ namespace HandyControl.Controls
/// 当前页
/// </summary>
public static readonly DependencyProperty PageIndexProperty = DependencyProperty.Register(
"PageIndex", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
"PageIndex", typeof(int), typeof(Pagination), new PropertyMetadata(ValueBoxes.Int1Box, (o, args) =>
{
if (o is Pagination pagination && args.NewValue is int value)
{
@@ -312,7 +312,7 @@ namespace HandyControl.Controls
}
var sub = PageIndex;
for (int i = 0; i < MaxPageInterval - 1; i++)
for (var i = 0; i < MaxPageInterval - 1; i++)
{
if (--sub > 1)
{
@@ -324,7 +324,7 @@ namespace HandyControl.Controls
}
}
var add = PageIndex;
for (int i = 0; i < MaxPageInterval - 1; i++)
for (var i = 0; i < MaxPageInterval - 1; i++)
{
if (++add < MaxPageCount)
{
@@ -33,7 +33,7 @@ namespace HandyControl.Controls
base.OnVisualChildrenChanged(visualAdded, visualRemoved);
var count = Items.Count;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
var item = (RadioButton)Items[i];
item.Style = ItemStyleSelector?.SelectStyle(item, this);
@@ -1,132 +0,0 @@
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using HandyControl.Tools.Converter;
namespace HandyControl.Controls
{
public class RelativePanel : Panel
{
public static readonly DependencyProperty AboveProperty = DependencyProperty.RegisterAttached(
"Above", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAbove(DependencyObject element, DependencyObject value) => element.SetValue(AboveProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAbove(DependencyObject element) => (DependencyObject)element.GetValue(AboveProperty);
public static readonly DependencyProperty AlignBottomWithProperty = DependencyProperty.RegisterAttached(
"AlignBottomWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignBottomWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignBottomWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignBottomWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignBottomWithProperty);
public static readonly DependencyProperty AlignBottomWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignBottomWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignBottomWithPanel(DependencyObject element, bool value) => element.SetValue(AlignBottomWithPanelProperty, value);
public static bool GetAlignBottomWithPanel(DependencyObject element) => (bool)element.GetValue(AlignBottomWithPanelProperty);
public static readonly DependencyProperty AlignHorizontalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignHorizontalCenterWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignHorizontalCenterWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignHorizontalCenterWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignHorizontalCenterWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignHorizontalCenterWithProperty);
public static readonly DependencyProperty AlignHorizontalCenterWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignHorizontalCenterWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignHorizontalCenterWithPanel(DependencyObject element, bool value) => element.SetValue(AlignHorizontalCenterWithPanelProperty, value);
public static bool GetAlignHorizontalCenterWithPanel(DependencyObject element) => (bool)element.GetValue(AlignHorizontalCenterWithPanelProperty);
public static readonly DependencyProperty AlignLeftWithProperty = DependencyProperty.RegisterAttached(
"AlignLeftWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignLeftWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignLeftWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignLeftWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignLeftWithProperty);
public static readonly DependencyProperty AlignLeftWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignLeftWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignLeftWithPanel(DependencyObject element, bool value) => element.SetValue(AlignLeftWithPanelProperty, value);
public static bool GetAlignLeftWithPanel(DependencyObject element) => (bool)element.GetValue(AlignLeftWithPanelProperty);
public static readonly DependencyProperty AlignRightWithProperty = DependencyProperty.RegisterAttached(
"AlignRightWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignRightWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignRightWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignRightWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignRightWithProperty);
public static readonly DependencyProperty AlignRightWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignRightWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignRightWithPanel(DependencyObject element, bool value) => element.SetValue(AlignRightWithPanelProperty, value);
public static bool GetAlignRightWithPanel(DependencyObject element) => (bool)element.GetValue(AlignRightWithPanelProperty);
public static readonly DependencyProperty AlignTopWithProperty = DependencyProperty.RegisterAttached(
"AlignTopWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignTopWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignTopWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignTopWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignTopWithProperty);
public static readonly DependencyProperty AlignTopWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignTopWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignTopWithPanel(DependencyObject element, bool value) => element.SetValue(AlignTopWithPanelProperty, value);
public static bool GetAlignTopWithPanel(DependencyObject element) => (bool)element.GetValue(AlignTopWithPanelProperty);
public static readonly DependencyProperty AlignVerticalCenterWithProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWith", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetAlignVerticalCenterWith(DependencyObject element, DependencyObject value) => element.SetValue(AlignVerticalCenterWithProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetAlignVerticalCenterWith(DependencyObject element) => (DependencyObject)element.GetValue(AlignVerticalCenterWithProperty);
public static readonly DependencyProperty AlignVerticalCenterWithPanelProperty = DependencyProperty.RegisterAttached(
"AlignVerticalCenterWithPanel", typeof(bool), typeof(RelativePanel), new PropertyMetadata(default(bool)));
public static void SetAlignVerticalCenterWithPanel(DependencyObject element, bool value) => element.SetValue(AlignVerticalCenterWithPanelProperty, value);
public static bool GetAlignVerticalCenterWithPanel(DependencyObject element) => (bool)element.GetValue(AlignVerticalCenterWithPanelProperty);
public static readonly DependencyProperty BelowProperty = DependencyProperty.RegisterAttached(
"Below", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetBelow(DependencyObject element, DependencyObject value) => element.SetValue(BelowProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetBelow(DependencyObject element) => (DependencyObject)element.GetValue(BelowProperty);
public static readonly DependencyProperty LeftOfProperty = DependencyProperty.RegisterAttached(
"LeftOf", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetLeftOf(DependencyObject element, DependencyObject value) => element.SetValue(LeftOfProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetLeftOf(DependencyObject element) => (DependencyObject)element.GetValue(LeftOfProperty);
public static readonly DependencyProperty RightOfProperty = DependencyProperty.RegisterAttached(
"RightOf", typeof(DependencyObject), typeof(RelativePanel), new PropertyMetadata(default(DependencyObject)));
public static void SetRightOf(DependencyObject element, DependencyObject value) => element.SetValue(RightOfProperty, value);
[TypeConverter(typeof(NameReferenceConverter))]
public static DependencyObject GetRightOf(DependencyObject element) => (DependencyObject)element.GetValue(RightOfProperty);
}
}
@@ -353,7 +353,7 @@ namespace HandyControl.Controls
{
if (_visualChildren == null) return 0;
for (int i = 0; i < _visualChildren.Length; i++)
for (var i = 0; i < _visualChildren.Length; i++)
{
if (_visualChildren[i] == null) return i;
}
@@ -38,7 +38,7 @@ namespace HandyControl.Controls
var count = Items.Count;
if (count <= 0) return;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
if (ItemContainerGenerator.ContainerFromIndex(i) is StepBarItem stepBarItem)
{
@@ -48,7 +48,7 @@ namespace HandyControl.Controls
if (StepIndex < count)
{
for (int i = 0; i < StepIndex; i++)
for (var i = 0; i < StepIndex; i++)
{
if (ItemContainerGenerator.ContainerFromIndex(i) is StepBarItem stepBarItem)
{
@@ -102,7 +102,7 @@ namespace HandyControl.Controls
private void CreateItemsSource(ItemsControl selector, int count)
{
var list = new List<string>();
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
list.Add(i.ToString("#00"));
}
@@ -340,7 +340,10 @@ namespace HandyControl.Controls
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
messageBox.Style = info.Style;
if (info.Style != null)
{
messageBox.Style = info.Style;
}
messageBox.ShowDialog();
}));
#else
@@ -356,7 +359,10 @@ namespace HandyControl.Controls
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
messageBox.Style = info.Style;
if (info.Style != null)
{
messageBox.Style = info.Style;
}
SystemSounds.Asterisk.Play();
messageBox.ShowDialog();
});
@@ -9,7 +9,6 @@ using HandyControl.Tools.Extension;
using Microsoft.Windows.Shell;
#else
using System.Windows.Shell;
#endif
namespace HandyControl.Controls
@@ -3,7 +3,7 @@ using System.Windows.Input;
namespace HandyControl.Data
{
internal class KeyboardHookEventArgs : EventArgs
public class KeyboardHookEventArgs : EventArgs
{
public bool IsSystemKey { get; }
@@ -1,37 +0,0 @@
namespace HandyControl_Shared.Data.Enum
{
public enum RelativeStatus
{
LeftOf,
Above,
RightOf,
Below,
AlignLeftWith,
AlignTopWith,
AlignRightWith,
AlignBottomWith,
AlignHorizontalCenterWith,
AlignVerticalCenterWith,
AlignLeftWithPanel,
AlignTopWithPanel,
AlignRightWithPanel,
AlignBottomWithPanel,
AlignHorizontalCenterWithPanel,
AlignVerticalCenterWithPanel
}
}
@@ -66,7 +66,7 @@ namespace HandyControl.Data
//
var values = frameDelayItem.Value;
_frameDelay = new int[FrameCount];
for (int i = 0; i < FrameCount; ++i)
for (var i = 0; i < FrameCount; ++i)
{
_frameDelay[i] = values[i * 4] + 256 * values[i * 4 + 1] + 256 * 256 * values[i * 4 + 2] + 256 * 256 * 256 * values[i * 4 + 3];
}
@@ -59,7 +59,7 @@ namespace HandyControl.Expression.Drawing
}
else
{
for (int i = list.Count - 1; i >= count; i--)
for (var i = list.Count - 1; i >= count; i--)
{
list.RemoveAt(i);
}
@@ -89,7 +89,7 @@ namespace HandyControl.Expression.Drawing
}
else
{
for (int i = list.Count; i < count; i++)
for (var i = list.Count; i < count; i++)
{
list.Add((factory == null) ? default(T) : factory());
}
@@ -2,6 +2,7 @@
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
using HandyControl.Data;
using HandyControl.Expression.Drawing;
using HandyControl.Expression.Media;
@@ -16,7 +17,7 @@ namespace HandyControl.Expression.Shapes
StretchProperty.OverrideMetadata(typeof(PrimitiveShape),
new DrawingPropertyMetadata(Stretch.Fill, DrawingPropertyMetadataOptions.AffectsRender));
StrokeThicknessProperty.OverrideMetadata(typeof(PrimitiveShape),
new DrawingPropertyMetadata(1.0, DrawingPropertyMetadataOptions.AffectsRender));
new DrawingPropertyMetadata(ValueBoxes.Double1Box, DrawingPropertyMetadataOptions.AffectsRender));
}
protected sealed override Geometry DefiningGeometry =>
@@ -18,13 +18,12 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\InfoElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PanelElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\PasswordBoxAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\RelativePanel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\RelativeStatus.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\NameReferenceConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\FrameworkElementExtension.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Extension\StringExtension.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\GlobalShortcut.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\StatusSwitchElement.cs" />
@@ -273,6 +272,10 @@
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\WNDCLASS.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\WpfSafeHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\MouseDragElementBehaviorEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\IPool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SimplePool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SynchronizedPool!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Queue\Deque!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularJudgment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\RegularPatterns.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\StyleSelector\RadioGroupItemStyleSelector.cs" />
@@ -3,6 +3,7 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Border.xaml"/>
<ResourceDictionary Source="Base/ToggleButtonBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
@@ -101,6 +102,124 @@
<!--开关-->
<Style x:Key="ToggleButtonSwitch" BasedOn="{StaticResource ToggleButtonSwitchBaseStyle}" TargetType="ToggleButton"/>
<!--翻转-->
<Style x:Key="ToggleButtonFlip" BasedOn="{StaticResource BaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="30"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<ControlTemplate.Resources>
<Storyboard x:Key="StoryboardChecked">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="StoryboardUnChecked">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="UnCheckedElement">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<PowerEase EasingMode="EaseOut"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Viewbox>
<controls:SimplePanel Height="28" Width="28">
<Border Name="UnCheckedElement" Style="{StaticResource BorderClip}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Border Name="CheckedElement" Style="{StaticResource BorderClip}" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{Binding Path=(controls:StatusSwitchElement.CheckedElement),RelativeSource={RelativeSource TemplatedParent}}"/>
</Border>
</controls:SimplePanel>
</Viewbox>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardChecked}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardUnChecked}"/>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--自定义-->
<Style x:Key="ToggleButtonCustom" BasedOn="{StaticResource BaseStyle}" TargetType="ToggleButton">
<Setter Property="Background" Value="Transparent"/>
@@ -0,0 +1,58 @@
using System.Windows;
namespace HandyControl.Tools.Extension
{
public static class FrameworkElementExtension
{
public static double GetValidWidth(this FrameworkElement element)
{
if (!double.IsNaN(element.Width))
{
if (element.Width > 0)
{
return element.Width;
}
}
else
{
if (element.ActualWidth > 0)
{
return element.ActualWidth;
}
if (element.DesiredSize.Width > 0)
{
return element.DesiredSize.Width;
}
}
return 0;
}
public static double GetValidHeight(this FrameworkElement element)
{
if (!double.IsNaN(element.Height))
{
if (element.Height > 0)
{
return element.Height;
}
}
else
{
if (element.ActualHeight > 0)
{
return element.ActualHeight;
}
if (element.DesiredSize.Height > 0)
{
return element.DesiredSize.Height;
}
}
return 0;
}
}
}
@@ -162,7 +162,7 @@ namespace HandyControl.Tools
try
{
// Find the corresponding reference and remove it
for (int i = 0; i < ImageInfoList.Count; i++)
for (var i = 0; i < ImageInfoList.Count; i++)
{
var imageInfo = ImageInfoList[i];
@@ -27,23 +27,23 @@ namespace HandyControl.Tools
}
var index = 0;
for (int i = 0; i < 2; i++)
for (var i = 0; i < 2; i++)
{
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(i, j, renderData[index] == 0);
}
}
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(2, j, renderData[index] == 0);
}
index -= 10;
for (int i = 3; i < 5; i++)
for (var i = 3; i < 5; i++)
{
for (int j = 0; j < 5; j++, index++)
for (var j = 0; j < 5; j++, index++)
{
AddRec(i, j, renderData[index] == 0);
}
@@ -78,7 +78,7 @@ namespace HandyControl.Tools
private int[] GetRenderData(string hashcode)
{
var arr = new int[RenderDataMaxLength];
for (int i = 0; i < RenderDataMaxLength; i++)
for (var i = 0; i < RenderDataMaxLength; i++)
{
var c = hashcode[i];
var v = (int) c;
@@ -22,11 +22,11 @@ namespace HandyControl.Tools
var arr = new int[count];
var div = num / count;
var rest = num % count;
for (int i = 0; i < count; i++)
for (var i = 0; i < count; i++)
{
arr[i] = div;
}
for (int i = 0; i < rest; i++)
for (var i = 0; i < rest; i++)
{
arr[i] += 1;
}
@@ -197,7 +197,7 @@ namespace HandyControl.Tools
var isBitmapIconDecoder = frames[0].Decoder is IconBitmapDecoder;
for (int i = 0; i < frames.Count && bestScore != 0; ++i)
for (var i = 0; i < frames.Count && bestScore != 0; ++i)
{
var currentIconBitDepth = isBitmapIconDecoder ? frames[i].Thumbnail.Format.BitsPerPixel : frames[i].Format.BitsPerPixel;
@@ -34,7 +34,7 @@ namespace HandyControl.Tools
return t;
}
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++)
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(d); i++)
{
var child = VisualTreeHelper.GetChild(d, i);
@@ -6,7 +6,7 @@ using HandyControl.Tools.Interop;
namespace HandyControl.Tools
{
internal class KeyboardHook
public class KeyboardHook
{
public static event EventHandler<KeyboardHookEventArgs> KeyDown;
@@ -0,0 +1,9 @@
namespace HandyControl.Tools
{
public interface IPool<T>
{
T Acquire();
bool Release(T instance);
}
}
@@ -0,0 +1,64 @@
//adapted from https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/Pools.java
using System;
namespace HandyControl.Tools
{
public class SimplePool<T> : IPool<T>
{
private readonly object[] _pool;
private int _poolSize;
public SimplePool(int maxPoolSize)
{
if (maxPoolSize <= 0)
{
throw new ArgumentException("The max pool size must be > 0");
}
_pool = new object[maxPoolSize];
}
public virtual T Acquire()
{
if (_poolSize > 0)
{
var lastPooledIndex = _poolSize - 1;
var instance = (T)_pool[lastPooledIndex];
_pool[lastPooledIndex] = null;
_poolSize--;
return instance;
}
return default;
}
public virtual bool Release(T instance)
{
if (IsInPool(instance))
{
throw new Exception("Already in the pool!");
}
if (_poolSize < _pool.Length)
{
_pool[_poolSize] = instance;
_poolSize++;
return true;
}
return false;
}
private bool IsInPool(T instance)
{
for (var i = 0; i < _poolSize; i++)
{
if (Equals(_pool[i], instance))
{
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,27 @@
namespace HandyControl.Tools
{
public class SynchronizedPool<T> : SimplePool<T>
{
private readonly object _lockObj = new object();
public SynchronizedPool(int maxPoolSize) : base(maxPoolSize)
{
}
public override T Acquire()
{
lock (_lockObj)
{
return base.Acquire();
}
}
public override bool Release(T element)
{
lock (_lockObj) {
return base.Release(element);
}
}
}
}
@@ -0,0 +1,345 @@
// adapted from https://www.c-sharpcorner.com/uploadfile/b942f9/implementing-a-double-ended-queue-or-deque-in-c-sharp/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
namespace HandyControl.Tools
{
[Serializable]
public class Deque<T> : IEnumerable<T>, ICollection
{
[NonSerialized]
private object _syncRoot;
private List<T> _front;
private List<T> _back;
private int _frontDeleted;
private int _backDeleted;
public int Capacity => _front.Capacity + _back.Capacity;
public int Count => _front.Count + _back.Count - _frontDeleted - _backDeleted;
public bool IsEmpty => Count == 0;
public IEnumerable<T> Reversed
{
get
{
if (_back.Count - _backDeleted > 0)
{
for (var i = _back.Count - 1; i >= _backDeleted; i--) yield return _back[i];
}
if (_front.Count - _frontDeleted > 0)
{
for (var i = _frontDeleted; i < _front.Count; i++) yield return _front[i];
}
}
}
public Deque()
{
_front = new List<T>();
_back = new List<T>();
}
public Deque(int capacity)
{
if (capacity < 0) throw new ArgumentException("Capacity cannot be negative");
var temp = capacity / 2;
var temp2 = capacity - temp;
_front = new List<T>(temp);
_back = new List<T>(temp2);
}
public Deque(IEnumerable<T> backCollection) : this(backCollection, null)
{
}
public Deque(IEnumerable<T> backCollection, IEnumerable<T> frontCollection)
{
if (backCollection == null && frontCollection == null) throw new ArgumentException("Collections cannot both be null");
_front = new List<T>();
_back = new List<T>();
if (backCollection != null)
{
foreach (var item in backCollection) _back.Add(item);
}
if (frontCollection != null)
{
foreach (var item in frontCollection) _front.Add(item);
}
}
public void AddFirst(T item)
{
if (_frontDeleted > 0 && _front.Count == _front.Capacity)
{
_front.RemoveRange(0, _frontDeleted);
_frontDeleted = 0;
}
_front.Add(item);
}
public void AddLast(T item)
{
if (_backDeleted > 0 && _back.Count == _back.Capacity)
{
_back.RemoveRange(0, _backDeleted);
_backDeleted = 0;
}
_back.Add(item);
}
public void AddRangeFirst(IEnumerable<T> range)
{
if (range == null) return;
foreach (var item in range) AddFirst(item);
}
public void AddRangeLast(IEnumerable<T> range)
{
if (range == null) return;
foreach (var item in range) AddLast(item);
}
public void Clear()
{
_front.Clear();
_back.Clear();
_frontDeleted = 0;
_backDeleted = 0;
}
public bool Contains(T item)
{
for (var i = _frontDeleted; i < _front.Count; i++)
{
if (Equals(_front[i], item)) return true;
}
for (var i = _backDeleted; i < _back.Count; i++)
{
if (Equals(_back[i], item)) return true;
}
return false;
}
public void CopyTo(T[] array, int index)
{
if (array == null) throw new ArgumentNullException("Array cannot be null");
if (index < 0) throw new ArgumentOutOfRangeException("Index cannot be negative");
if (array.Length < index + Count) throw new ArgumentException("Index is invalid");
var i = index;
foreach (var item in this)
{
array[i++] = item;
}
}
public IEnumerator<T> GetEnumerator()
{
if (_front.Count - _frontDeleted > 0)
{
for (var i = _front.Count - 1; i >= _frontDeleted; i--) yield return _front[i];
}
if (_back.Count - _backDeleted > 0)
{
for (var i = _backDeleted; i < _back.Count; i++) yield return _back[i];
}
}
public T PeekFirst()
{
if (_front.Count > _frontDeleted)
{
return _front[_front.Count - 1];
}
if (_back.Count > _backDeleted)
{
return _back[_backDeleted];
}
throw new InvalidOperationException("Can't peek at empty Deque");
}
public T PeekLast()
{
if (_back.Count > _backDeleted)
{
return _back[_back.Count - 1];
}
if (_front.Count > _frontDeleted)
{
return _front[_frontDeleted];
}
throw new InvalidOperationException("Can't peek at empty Deque");
}
public T PopFirst()
{
T result;
if (_front.Count > _frontDeleted)
{
result = _front[_front.Count - 1];
_front.RemoveAt(_front.Count - 1);
}
else if (_back.Count > _backDeleted)
{
result = _back[_backDeleted];
_backDeleted++;
}
else
{
throw new InvalidOperationException("Can't pop empty Deque");
}
return result;
}
public T PopLast()
{
T result;
if (_back.Count > _backDeleted)
{
result = _back[_back.Count - 1];
_back.RemoveAt(_back.Count - 1);
}
else if (_front.Count > _frontDeleted)
{
result = _front[_frontDeleted];
_frontDeleted++;
}
else
{
throw new InvalidOperationException("Can't pop empty Deque");
}
return result;
}
public void Reverse()
{
var temp = _front;
_front = _back;
_back = temp;
var temp2 = _frontDeleted;
_frontDeleted = _backDeleted;
_backDeleted = temp2;
}
public T[] ToArray()
{
if (Count == 0) return new T[0];
var result = new T[Count];
CopyTo(result, 0);
return result;
}
public void TrimExcess()
{
if (_frontDeleted > 0)
{
_front.RemoveRange(0, _frontDeleted);
_frontDeleted = 0;
}
if (_backDeleted > 0)
{
_back.RemoveRange(0, _backDeleted);
_backDeleted = 0;
}
_front.TrimExcess();
_back.TrimExcess();
}
public bool TryPeekFirst(out T item)
{
if (!IsEmpty)
{
item = PeekFirst();
return true;
}
item = default;
return false;
}
public bool TryPeekLast(out T item)
{
if (!IsEmpty)
{
item = PeekLast();
return true;
}
item = default;
return false;
}
public bool TryPopFirst(out T item)
{
if (!IsEmpty)
{
item = PopFirst();
return true;
}
item = default;
return false;
}
public bool TryPopLast(out T item)
{
if (!IsEmpty)
{
item = PopLast();
return true;
}
item = default;
return false;
}
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
}
void ICollection.CopyTo(Array array, int index) => CopyTo((T[])array, index);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}