This commit is contained in:
Mahdi committed 2019-12-01 18:44:09 +03:30
commit b2faec3374
24 files changed
+669 -44

No files matched your search

+5 -1
View File
@@ -3,4 +3,8 @@
*.xml
[Bb]in/
[Oo]bj/
packages/
packages/
build/*
!build/build.cake
!build/build.nuspec
!build/build.ps1
@@ -1,7 +1,7 @@
<?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="2.2.0" Language="en-US" Publisher="HandyOrg" />
<Identity Id="5949c79d-eb43-4033-8b7b-9349d34512c6" Version="2.3.0" 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>
@@ -34,8 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="HandyControl, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HandyControl.2.2.0\lib\net47\HandyControl.dll</HintPath>
<Reference Include="HandyControl, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HandyControl.2.3.0\lib\net47\HandyControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xaml">
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HandyControl" version="2.2.0" targetFramework="net47" />
<package id="HandyControl" version="2.3.0" targetFramework="net47" />
</packages>
@@ -19,6 +19,6 @@
<DefineConstants>TRACE;Core</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HandyControl" Version="2.2.0" />
<PackageReference Include="HandyControl" Version="2.3.0" />
</ItemGroup>
</Project>
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
+5
View File
@@ -34,6 +34,7 @@
<a href="https://github.com/yanchao891012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4"></a>
<a href="https://github.com/noctwolf" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/21022467?s=400&v=4"></a>
<a href="https://github.com/xianyun666" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/22339210?s=400&v=4"></a>
<a href="https://github.com/afunc233" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/19919631?s=400&v=4"></a>
## Backers
@@ -48,7 +49,11 @@
## Special thanks to
[![Visual Studio Community 2019](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/vs2019_logo.png)](https://visualstudio.microsoft.com/free-developer-offers/)
[![JetBrains](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/resharper_logo.png)](https://www.jetbrains.com/?from=HandyControl)
[![Cake](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/cake_logo.png)](https://cakebuild.net/)
[![AppVeyor](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/appveyor_logo.png)](https://www.appveyor.com/)
[![Gitter](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/gitter_logo.png)](https://gitter.im/)
## Usage
+62
View File
@@ -0,0 +1,62 @@
var target = Argument("target", "Build");
Task("Clean")
.Does(() =>
{
CleanDirectory("lib");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
var vsLatest = VSWhereLatest();
var msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
NuGetRestore("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj");
var settingsNet40 = new MSBuildSettings
{
Configuration = "Release",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net40")).FullPath);
var settingsNet45 = new MSBuildSettings
{
Configuration = "Release-Net45",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net45")).FullPath);
var settingsNet462 = new MSBuildSettings
{
Configuration = "Release-Net462",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net462")).FullPath);
var settingsNet47 = new MSBuildSettings
{
Configuration = "Release-Net47",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net47")).FullPath);
var settingsNet48 = new MSBuildSettings
{
Configuration = "Release-Net48",
ToolPath = msBuildPath,
}.WithProperty("OutputPath", MakeAbsolute(Directory("lib/net48")).FullPath);
var settingsCore30 = new DotNetCoreBuildSettings
{
Framework = "netcoreapp3.0",
Configuration = "Release",
OutputDirectory = "lib/netcoreapp3.0"
};
MSBuild("../src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj", settingsNet40);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet45);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet462);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet47);
MSBuild("../src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj", settingsNet48);
DotNetCoreBuild("../src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj", settingsCore30);
});
RunTarget(target);
+70
View File
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>HandyControl</id>
<version>2.3.0</version>
<title>HandyOrg</title>
<authors>HandyOrg</authors>
<owners>HandyOrg</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectUrl>https://github.com/NaBian/HandyControl</projectUrl>
<iconUrl>https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/icon.png</iconUrl>
<description>Contains some commonly used simple WPF controls</description>
<releaseNotes>Changes are detailed at https://github.com/HandyOrg/HandyControl/releases</releaseNotes>
<copyright>Copyright © HandyOrg 2018-2019</copyright>
<language></language>
<tags>WPF C# Control</tags>
<repository type="git" url="https://github.com/HandyOrg/HandyControl" commit="1af8ac90f497e6c65e4d596604f89f54e21cbcc6" />
<dependencies>
<group targetFramework=".NETFramework4.0">
<dependency id="Microsoft.Windows.Shell" version="3.0.1" />
</group>
<group targetFramework=".NETFramework4.5" />
<group targetFramework=".NETFramework4.6.2" />
<group targetFramework=".NETFramework4.7" />
<group targetFramework=".NETFramework4.8" />
<group targetFramework=".NETCoreApp3.0" />
</dependencies>
</metadata>
<files>
<file src="lib\net40\en\HandyControl.resources.dll" target="lib\net40\en\HandyControl.resources.dll" />
<file src="lib\net40\fa\HandyControl.resources.dll" target="lib\net40\fa\HandyControl.resources.dll" />
<file src="lib\net40\fr\HandyControl.resources.dll" target="lib\net40\fr\HandyControl.resources.dll" />
<file src="lib\net40\HandyControl.dll" target="lib\net40\HandyControl.dll" />
<file src="lib\net40\HandyControl.pdb" target="lib\net40\HandyControl.pdb" />
<file src="lib\net40\HandyControl.xml" target="lib\net40\HandyControl.xml" />
<file src="lib\net40\Microsoft.Windows.Shell.dll" target="lib\net40\Microsoft.Windows.Shell.dll" />
<file src="lib\net40\Microsoft.Windows.Shell.pdb" target="lib\net40\Microsoft.Windows.Shell.pdb" />
<file src="lib\net45\en\HandyControl.resources.dll" target="lib\net45\en\HandyControl.resources.dll" />
<file src="lib\net45\fa\HandyControl.resources.dll" target="lib\net45\fa\HandyControl.resources.dll" />
<file src="lib\net45\fr\HandyControl.resources.dll" target="lib\net45\fr\HandyControl.resources.dll" />
<file src="lib\net45\HandyControl.dll" target="lib\net45\HandyControl.dll" />
<file src="lib\net45\HandyControl.pdb" target="lib\net45\HandyControl.pdb" />
<file src="lib\net45\HandyControl.xml" target="lib\net45\HandyControl.xml" />
<file src="lib\net462\en\HandyControl.resources.dll" target="lib\net462\en\HandyControl.resources.dll" />
<file src="lib\net462\fa\HandyControl.resources.dll" target="lib\net462\fa\HandyControl.resources.dll" />
<file src="lib\net462\fr\HandyControl.resources.dll" target="lib\net462\fr\HandyControl.resources.dll" />
<file src="lib\net462\HandyControl.dll" target="lib\net462\HandyControl.dll" />
<file src="lib\net462\HandyControl.pdb" target="lib\net462\HandyControl.pdb" />
<file src="lib\net462\HandyControl.xml" target="lib\net462\HandyControl.xml" />
<file src="lib\net47\en\HandyControl.resources.dll" target="lib\net47\en\HandyControl.resources.dll" />
<file src="lib\net47\fa\HandyControl.resources.dll" target="lib\net47\fa\HandyControl.resources.dll" />
<file src="lib\net47\fr\HandyControl.resources.dll" target="lib\net47\fr\HandyControl.resources.dll" />
<file src="lib\net47\HandyControl.dll" target="lib\net47\HandyControl.dll" />
<file src="lib\net47\HandyControl.pdb" target="lib\net47\HandyControl.pdb" />
<file src="lib\net47\HandyControl.xml" target="lib\net47\HandyControl.xml" />
<file src="lib\net48\en\HandyControl.resources.dll" target="lib\net48\en\HandyControl.resources.dll" />
<file src="lib\net48\fa\HandyControl.resources.dll" target="lib\net48\fa\HandyControl.resources.dll" />
<file src="lib\net48\fr\HandyControl.resources.dll" target="lib\net48\fr\HandyControl.resources.dll" />
<file src="lib\net48\HandyControl.dll" target="lib\net48\HandyControl.dll" />
<file src="lib\net48\HandyControl.pdb" target="lib\net48\HandyControl.pdb" />
<file src="lib\net48\HandyControl.xml" target="lib\net48\HandyControl.xml" />
<file src="lib\netcoreapp3.0\en\HandyControl.resources.dll" target="lib\netcoreapp3.0\en\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\fa\HandyControl.resources.dll" target="lib\netcoreapp3.0\fa\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\fr\HandyControl.resources.dll" target="lib\netcoreapp3.0\fr\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\HandyControl.deps.json" target="lib\netcoreapp3.0\HandyControl.deps.json" />
<file src="lib\netcoreapp3.0\HandyControl.dll" target="lib\netcoreapp3.0\HandyControl.dll" />
<file src="lib\netcoreapp3.0\HandyControl.pdb" target="lib\netcoreapp3.0\HandyControl.pdb" />
<file src="lib\netcoreapp3.0\HandyControl.xml" target="lib\netcoreapp3.0\HandyControl.xml" />
</files>
</package>
+256
View File
@@ -0,0 +1,256 @@
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER ShowDescription
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
https://cakebuild.net
#>
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity,
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
# message though)
try {
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
# installed (.NET 4.5 is an in-place upgrade).
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
if (-not $IsCoreCLR) {
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
}
} catch {
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
}
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
{
return $null
}
[System.IO.Stream] $file = $null;
[System.Security.Cryptography.MD5] $md5 = $null;
try
{
$md5 = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::OpenRead($filePath)
return [System.BitConverter]::ToString($md5.ComputeHash($file))
}
finally
{
if ($file -ne $null)
{
$file.Dispose()
}
}
}
function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://github.com/HandyOrg/HandyOrgResource/blob/master/Tools/nuget.exe?raw=true"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
} catch {
Throw "Could not download packages.config."
}
}
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
}
}
# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
# Save nuget.exe path to environment to be available to child processed
$env:NUGET_EXE = $NUGET_EXE
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$NUGET_EXE`""
} else {
"`"$NUGET_EXE`""
}
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
Remove-Item -Recurse -Force
}
Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR
Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet addins."
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR
Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet modules."
}
Write-Verbose -Message ($NuGetOutput | Out-String)
Pop-Location
}
# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$CAKE_EXE`""
} else {
"`"$CAKE_EXE`""
}
# Build an array (not a string) of Cake arguments to be joined later
$cakeArguments = @()
if ($Script) { $cakeArguments += "`"$Script`"" }
if ($Target) { $cakeArguments += "-target=`"$Target`"" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
$cakeArguments += $ScriptArgs
# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
exit $LASTEXITCODE
@@ -1,5 +1,77 @@
---
title: 建设中
title: VisualElement 可视化元素
---
建设中
# 属性
| 名称 | 用途 |
| -------------- | ---------------- |
| HighlightBrush | 设置控件高亮颜色 |
| Text | 设置文本内容 |
# 使用案例
## HighlightBrush 设置控件高亮颜色
```xml
<UniformGrid Margin="22,22,0,0" Rows="2" Columns="2">
<RadioButton Margin="10,10,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}"
Content="RadioButton" IsChecked="True"
GroupName="radio1"/>
<RadioButton Margin="10,10,0,0" BorderThickness="1"
Style="{StaticResource RadioButtonIcon}"
hc:VisualElement.HighlightBrush="YellowGreen"
Content="RadioButton"
GroupName="radio2"/>
</UniformGrid>
```
如下截图为一组选中状态时的高亮对比结果,左图为样式`默认颜色`,右侧为个人`自定义颜色`
![VisualElement.HighlightBrush](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach/VisualElement.HighlightBrush.png)
## Text 设置文本内容
主要用于设置控件的辅助文本,当控件没有合适的属性用于显示文本时,可通过此附加属性在自定义样式中设置。
例如:当自定义进度条,需要显示文本时,本身缺少显示额外文本内容的属性,可以通过自定样式显示对应文本,以`Text`作为文本内容承载属性
自定义样式:
```xml
<Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar">
<Setter Property="controls:VisualElement.Text">
<Setter.Value>
.....忽略代码.....
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<controls:SimplePanel x:Name="TemplateRoot">
....忽略代码....
<controls:SimplePanel HorizontalAlignment="Left">
....忽略代码....
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Path=(controls:VisualElement.Text),RelativeSource={RelativeSource TemplatedParent}}"/>
</controls:SimplePanel>
</controls:SimplePanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
```
`xaml`中的使用:
```xml
<UniformGrid Margin="22,22,0,0" Rows="2" Columns="2">
<ProgressBar Style="{DynamicResource ProgressBarDanger}"
hc:VisualElement.Text="这是可视化文本"
Background="YellowGreen"></ProgressBar>
</UniformGrid>
```
效果:
![VisualElement.Text](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach/VisualElement.Text.png)
@@ -1,5 +1,54 @@
---
title: 建设中
title: WindowAttach 窗体专用
---
建设中
# 属性
| 名称 | 用途 |
| ----------------- | ------------------------------------------------------------ |
| IsDragElement | 是否允许当前元素可拖动窗体 |
| IgnoreAltF4 | 是否忽略快捷键Alt和F4(键盘快速退出或者 结束 当前正在运行的应用程序) |
| ShowInTaskManager | 是否窗体显示到任务管理器中 |
# 使用案例
## IsDragElement 是否允许当前元素可拖动窗体
```xml
<hc:BlurWindow x:Class="类命名空间"
.....常规项......
WindowStartupLocation="CenterScreen"
ShowTitle="True"
Style="{DynamicResource WindowBlur}"
xmlns:hc="https://handyorg.github.io/handycontrol"
d:DesignHeight="450" d:DesignWidth="800">
<hc:SimplePanel>
<Rectangle VerticalAlignment="Top" Margin="10" Height="30" RadiusX="4" RadiusY="4" Stroke="{DynamicResource BorderBrush}" StrokeDashArray="2,2"/>
<Border hc:WindowAttach.IsDragElement="True" VerticalAlignment="Top" Margin="11" Height="28" Background="{DynamicResource DarkDefaultBrush}" CornerRadius="4">
<TextBlock Text="DragHere" Style="{StaticResource TextBlockDefault}"/>
</Border>
<Button HorizontalAlignment="Right" Margin="0,15,15,0" VerticalAlignment="Top" Padding="0" Height="20" Width="20" Style="{StaticResource ButtonPrimary}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" hc:BorderElement.CornerRadius="15"/>
</hc:SimplePanel>
</hc:BlurWindow>
```
可在深色框区域鼠标拖动窗体
![WindowAttach.IsDragElement](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/attach/WindowAttach.IsDragElement.png)
## IgnoreAltF4 是否忽略快捷键Alt和F4
用于屏蔽窗口的 Alt+F4 关闭功能。
```xml
<Setter Property="hc:WindowAttach.IgnoreAltF4" Value="True"/>
```
## ShowInTaskManager 是否将窗体显示到任务管理器中
使用前提:
- 窗口必须为非模态窗口,即不能使用`ShowDialog`显示窗口。
- 窗口必须同时设置`ShowInTaskBar`为`false`
ps:该附加属性在`Windows7`中效果不是很明显
@@ -7,7 +7,7 @@ title: Expander 展开框
Expander 展开框 默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
{% note info no-icon %}
用例:
{% code %}
<StackPanel Margin="32" VerticalAlignment="Center" Width="240">
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{DynamicResource BorderBrush}">
@@ -1,5 +1,84 @@
---
title: 建设中
title: GroupBox 分组框
---
建设中
# GroupBoxBaseStyle
GroupBox 分组框 默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
{% note info no-icon %}
用例:
{% code %}
<GroupBox Grid.Row="0" Grid.Column="0" Width="300" Height="200" Header="{x:Static langs:Lang.TitleDemoStr1}"
Padding="10" Margin="16">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"/>
</Border>
</GroupBox>
{% endcode %}
![GroupBoxBaseStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Base.png)
{% endnote %}
这里提供另外一种样式,供开发者选择
{% note info no-icon %}
只需要添加扩展属性即可
{% code %}
hc:TitleElement.TitleAlignment="Left"
{% endcode %}
用例:
{% code %}
<GroupBox Grid.Row="0" Grid.Column="1" Width="300" Height="200" Header="{x:Static langs:Lang.TitleDemoStr1}" Padding="10"
Margin="16" hc:TitleElement.TitleAlignment="Left">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"/>
</Border>
</GroupBox>
{% endcode %}
![GroupBox_Base_left](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Base_left.png)
{% endnote %}
# GroupBoxTab : GroupBoxTabBaseStyle : GroupBoxBaseStyle
GroupBox 分组框 的另一种样式 GroupBoxTabBaseStyle 不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
{% note info no-icon %}
用例:
{% code %}
<GroupBox Grid.Row="1" Grid.Column="0" Width="300" Height="200" Header="{x:Static langs:Lang.TitleDemoStr1}" Padding="10"
Margin="16" Style="{StaticResource GroupBoxTab}">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"/>
</Border>
</GroupBox>
{% endcode %}
- 同样可以 使用扩展属性 {% code %} hc:TitleElement.TitleAlignment="Left" {% endcode %}
![GroupBox_Tab](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Tab.png) ![GroupBox_Tab_left](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Tab_left.png)
{% endnote %}
# GroupBoxOriginal : GroupBoxOriginalBaseStyle : GroupBoxBaseStyle
GroupBox 分组框 的另一种样式 GroupBoxOriginalBaseStyle 不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
{% note info no-icon %}
用例:
{% code %}
<GroupBox Grid.Row="2" Grid.Column="0" Width="300" Header="{x:Static langs:Lang.TitleDemoStr1}" Margin="16"
Style="{StaticResource GroupBoxOriginal}" HorizontalContentAlignment="Left">
<TextBox/>
</GroupBox>
<GroupBox Grid.Row="2" VerticalAlignment="Bottom" Grid.Column="1" Width="300" hc:TitleElement.TitleWidth="100"
Header="{x:Static langs:Lang.TitleDemoStr1}" Margin="16" Style="{StaticResource GroupBoxOriginal}"
HorizontalContentAlignment="Left" hc:TitleElement.TitleAlignment="Left">
<ComboBox DataContext="{Binding ComboBoxDemo,Source={StaticResource Locator}}" ItemsSource="{Binding DataList}"/>
</GroupBox>
{% endcode %}
![GroupBox_Origin](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Origin.png) ![GroupBox_Origin_left](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/GroupBox_Origin_left.png)
{% endnote %}
+2 -2
View File
@@ -4,7 +4,7 @@ title: 鸣谢
# 感谢以下Coder提供代码贡献
<p><a style="border:0" href="https://github.com/ghost1372" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/9213496?s=400&amp;v=4" alt="ghost1372"></a><a style="border:0" href="https://github.com/DingpingZhang" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/8541016?s=400&v=4" alt="Dingping Zhang"></a><a style="border:0" href="https://github.com/M0n7y5" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/17201053?s=400&v=4" alt="M0n7y5"></a><a style="border:0" href="https://github.com/guanguanchuangyu" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/25916858?s=400&v=4" alt="guanguanchuangyu"></a><a style="border:0" href="https://github.com/yanchao891012" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4" alt="yanchao891012"></a><a style="border:0" href="https://github.com/noctwolf" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/21022467?s=400&v=4" alt="noctwolf"></a><a style="border:0" href="https://github.com/xianyun666" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/22339210?s=400&v=4" alt="xianyun666"></a></p>
<p><a style="border:0" href="https://github.com/ghost1372" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/9213496?s=400&amp;v=4" alt="ghost1372"></a><a style="border:0" href="https://github.com/DingpingZhang" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/8541016?s=400&v=4" alt="Dingping Zhang"></a><a style="border:0" href="https://github.com/M0n7y5" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/17201053?s=400&v=4" alt="M0n7y5"></a><a style="border:0" href="https://github.com/guanguanchuangyu" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/25916858?s=400&v=4" alt="guanguanchuangyu"></a><a style="border:0" href="https://github.com/yanchao891012" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4" alt="yanchao891012"></a><a style="border:0" href="https://github.com/noctwolf" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/21022467?s=400&v=4" alt="noctwolf"></a><a style="border:0" href="https://github.com/xianyun666" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/22339210?s=400&v=4" alt="xianyun666"></a><a style="border:0" href="https://github.com/afunc233" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/19919631?s=400&v=4" alt="afunc233"></a></p>
# 感谢以下组织机构提供开源许可
@@ -12,4 +12,4 @@ title: 鸣谢
# 感谢以下捐赠者
<p><a style="border:0" href="https://github.com/bigorange1900" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/49062011?s=400&v=4" alt="bigorange1900"></a><a style="border:0" href="https://github.com/14632791" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/27358331?s=400&v=4" alt="bigorange1900"></a><a style="border:0" href="https://github.com/IUpdatable" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars2.githubusercontent.com/u/51181716?s=400&v=4" alt="bigorange1900"></a><a style="border:0" href="https://github.com/maplewei" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/13778095?s=400&v=4" alt="bigorange1900"></a><a style="border:0" href="https://github.com/sunshang-hl" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/34593206?s=400&v=4" alt="bigorange1900"></a></p>
<p><a style="border:0" href="https://github.com/bigorange1900" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/49062011?s=400&v=4" alt="bigorange1900"></a><a style="border:0" href="https://github.com/14632791" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/27358331?s=400&v=4" alt="14632791"></a><a style="border:0" href="https://github.com/IUpdatable" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars2.githubusercontent.com/u/51181716?s=400&v=4" alt="IUpdatable"></a><a style="border:0" href="https://github.com/maplewei" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/13778095?s=400&v=4" alt="maplewei"></a><a style="border:0" href="https://github.com/sunshang-hl" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/34593206?s=400&v=4" alt="sunshang-hl"></a><a style="border:0" href="https://github.com/yangkang326" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars1.githubusercontent.com/u/51224259?s=400&v=4" alt="yangkang326"></a><a style="border:0" href="https://github.com/zmrbak" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars3.githubusercontent.com/u/7257543?s=400&v=4" alt="zmrbak"></a><a style="border:0" href="https://github.com/AFei19911012" target="_blank" rel="noopener"><img width="120" height="120" src="https://avatars0.githubusercontent.com/u/31465314?s=400&v=4" alt="AFei19911012"></a></p>
@@ -58,7 +58,7 @@
</hc:NotifyIcon>
<hc:NotifyIcon Token="{x:Static data:MessageToken.NotifyIconContextDemo}" x:Name="NotifyIconContextContent" Text="HandyControl" IsBlink="{Binding ContextContentIsBlink}" Visibility="{Binding ContextContentIsShow,Converter={StaticResource Boolean2VisibilityConverter}}" Icon="/HandyControlDemo;component/Resources/Img/icon-white.ico">
<hc:NotifyIcon.ContextContent>
<Border CornerRadius="4" Margin="10" Background="White" Effect="{StaticResource EffectShadow2}">
<Border CornerRadius="4" Margin="10" Background="{DynamicResource RegionBrush}" Effect="{StaticResource EffectShadow2}">
<StackPanel VerticalAlignment="Center" Margin="16">
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
<StackPanel Margin="0,16,0,0" HorizontalAlignment="Center" Orientation="Horizontal">
@@ -636,6 +636,22 @@ namespace HandyControl.Controls
}
else if (ContextMenu != null)
{
if (ContextMenu.Items.Count == 0) return;
ContextMenu.InvalidateProperty(StyleProperty);
foreach (var item in ContextMenu.Items)
{
if (item is MenuItem menuItem)
{
menuItem.InvalidateProperty(StyleProperty);
}
else
{
var container = ContextMenu.ItemContainerGenerator.ContainerFromItem(item) as MenuItem;
container?.InvalidateProperty(StyleProperty);
}
}
ContextMenu.Placement = PlacementMode.Mouse;
ContextMenu.IsOpen = true;
@@ -304,7 +304,7 @@ namespace HandyControl.Controls
ItemIsDragging = true;
_isWaiting = true;
_dragPoint = e.GetPosition(parent);
_dragPoint = new Point(_dragPoint.X + +_scrollHorizontalOffset, _dragPoint.Y);
_dragPoint = new Point(_dragPoint.X + _scrollHorizontalOffset, _dragPoint.Y);
_mouseDownPoint = _dragPoint;
CaptureMouse();
}
@@ -432,6 +432,11 @@ namespace HandyControl.Controls
/// <returns></returns>
private int CalLocationIndex(double left)
{
if (_isWaiting)
{
return CurrentIndex;
}
var maxIndex = TabControlParent.Items.Count - 1;
var div = (int)(left / ItemWidth);
var rest = left % ItemWidth;
@@ -909,10 +909,4 @@
<Folder Include="$(MSBuildThisFileDirectory)Controls\Growl\" />
<Folder Include="$(MSBuildThisFileDirectory)Tools\Generator\" />
</ItemGroup>
<ItemGroup>
<Page Update="E:\Work\GitHub\HandyControl\src\Shared\HandyControl_Shared\Themes\Styles\Base\SplitButtonBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>
@@ -4,8 +4,8 @@ using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
using HandyControl.Tools;
// ReSharper disable PossibleInvalidOperationException
// ReSharper disable PossibleInvalidOperationException
namespace HandyControl.Media.Animation
{
public class GeometryAnimation : GeometryAnimationBase
@@ -20,7 +20,7 @@ namespace HandyControl.Media.Animation
public GeometryAnimation()
{
}
public GeometryAnimation(string fromValue, string toValue) : this()
@@ -1,4 +1,6 @@
using System;
using System.Globalization;
using System.Threading;
using System.Windows.Media;
using System.Windows.Media.Animation;
@@ -6,6 +8,11 @@ namespace HandyControl.Media.Animation
{
public abstract class GeometryAnimationBase : AnimationTimeline
{
protected GeometryAnimationBase()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}
public new GeometryAnimationBase Clone() => (GeometryAnimationBase)base.Clone();
public sealed override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)
@@ -11,7 +11,6 @@ using System.Windows.Media.Animation;
using HandyControl.Tools;
// ReSharper disable PossibleInvalidOperationException
namespace HandyControl.Media.Animation
{
[ContentProperty("KeyFrames")]
@@ -38,7 +37,10 @@ namespace HandyControl.Media.Animation
private bool _areKeyTimesValid;
public GeometryAnimationUsingKeyFrames() => _areKeyTimesValid = true;
public GeometryAnimationUsingKeyFrames()
{
_areKeyTimesValid = true;
}
public new GeometryAnimationUsingKeyFrames Clone() => (GeometryAnimationUsingKeyFrames)base.Clone();
@@ -516,4 +518,4 @@ namespace HandyControl.Media.Animation
while (index < maxKeyFrameIndex);
}
}
}
}
@@ -237,12 +237,14 @@
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</EventTrigger>
<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -285,12 +287,14 @@
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</EventTrigger>
<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>