Merge branch 'master' of https://github.com/handyorg/HandyControl
This commit is contained in:
commit
e812e15147
50 files changed
+769
-49
No files matched your search
@@ -39,8 +39,18 @@ namespace HandyControl.Controls
|
||||
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (GifImage) d;
|
||||
var v = (Uri)e.NewValue;
|
||||
ctl.Source = new BitmapImage(v);
|
||||
ctl.StopAnimate();
|
||||
|
||||
if (e.NewValue != null)
|
||||
{
|
||||
var v = (Uri)e.NewValue;
|
||||
ctl.GetGifStreamFromPack(v);
|
||||
ctl.StartAnimate();
|
||||
}
|
||||
else
|
||||
{
|
||||
ctl.Source = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Uri Uri
|
||||
|
||||
@@ -622,6 +622,11 @@ namespace HandyControl.Controls
|
||||
|
||||
if (SelectedDateTime != null)
|
||||
{
|
||||
if (SelectedDateTime != DisplayDateTime)
|
||||
{
|
||||
SetCurrentValue(DisplayDateTimeProperty, SelectedDateTime);
|
||||
}
|
||||
|
||||
var selectedTime = DateTimeToString(SelectedDateTime.Value);
|
||||
|
||||
if (string.Compare(selectedTime, s, StringComparison.Ordinal) == 0)
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace HandyControl.Controls
|
||||
menu.SetBinding(VisibilityProperty, new Binding(ShowContextMenuProperty.Name)
|
||||
{
|
||||
Source = this,
|
||||
Converter = ResourceHelper.GetResource<IValueConverter>("Boolean2VisibilityConverter")
|
||||
Converter = ResourceHelper.GetResource<IValueConverter>(ResourceToken.Boolean2VisibilityConverter)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,76 @@
|
||||
{
|
||||
public class ResourceToken
|
||||
{
|
||||
#region Basic
|
||||
|
||||
#region Geometry
|
||||
|
||||
public const string CalendarGeometry = nameof(CalendarGeometry);
|
||||
|
||||
public const string DeleteGeometry = nameof(DeleteGeometry);
|
||||
|
||||
public const string DeleteFillCircleGeometry = nameof(DeleteFillCircleGeometry);
|
||||
|
||||
public const string CloseGeometry = nameof(CloseGeometry);
|
||||
|
||||
public const string UpGeometry = nameof(UpGeometry);
|
||||
|
||||
public const string DownGeometry = nameof(DownGeometry);
|
||||
|
||||
public const string ClockGeometry = nameof(ClockGeometry);
|
||||
|
||||
public const string LeftGeometry = nameof(LeftGeometry);
|
||||
|
||||
public const string RightGeometry = nameof(RightGeometry);
|
||||
|
||||
public const string RotateLeftGeometry = nameof(RotateLeftGeometry);
|
||||
|
||||
public const string EnlargeGeometry = nameof(EnlargeGeometry);
|
||||
|
||||
public const string ReduceGeometry = nameof(ReduceGeometry);
|
||||
|
||||
public const string DownloadGeometry = nameof(DownloadGeometry);
|
||||
|
||||
public const string SaveGeometry = nameof(SaveGeometry);
|
||||
|
||||
public const string WindowsGeometry = nameof(WindowsGeometry);
|
||||
|
||||
public const string FullScreenGeometry = nameof(FullScreenGeometry);
|
||||
|
||||
public const string FullScreenReturnGeometry = nameof(FullScreenReturnGeometry);
|
||||
|
||||
public const string SearchGeometry = nameof(SearchGeometry);
|
||||
|
||||
public const string UpDownGeometry = nameof(UpDownGeometry);
|
||||
|
||||
public const string WindowMinGeometry = nameof(WindowMinGeometry);
|
||||
|
||||
public const string CheckedGeometry = nameof(CheckedGeometry);
|
||||
|
||||
public const string EyeOpenGeometry = nameof(EyeOpenGeometry);
|
||||
|
||||
public const string EyeCloseGeometry = nameof(EyeCloseGeometry);
|
||||
|
||||
public const string WindowRestoreGeometry = nameof(WindowRestoreGeometry);
|
||||
|
||||
public const string WindowMaxGeometry = nameof(WindowMaxGeometry);
|
||||
|
||||
public const string AudioGeometry = nameof(AudioGeometry);
|
||||
|
||||
public const string BubbleTailGeometry = nameof(BubbleTailGeometry);
|
||||
|
||||
public const string StarGeometry = nameof(StarGeometry);
|
||||
|
||||
public const string AddGeometry = nameof(AddGeometry);
|
||||
|
||||
public const string SubGeometry = nameof(SubGeometry);
|
||||
|
||||
public const string AllGeometry = nameof(AllGeometry);
|
||||
|
||||
public const string DragGeometry = nameof(DragGeometry);
|
||||
|
||||
public const string DropperGeometry = nameof(DropperGeometry);
|
||||
|
||||
public const string SuccessGeometry = nameof(SuccessGeometry);
|
||||
|
||||
public const string InfoGeometry = nameof(InfoGeometry);
|
||||
@@ -14,22 +84,214 @@
|
||||
|
||||
public const string FatalGeometry = nameof(FatalGeometry);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Brush
|
||||
|
||||
public const string PrimaryBrush = nameof(PrimaryBrush);
|
||||
|
||||
public const string DarkPrimaryBrush = nameof(DarkPrimaryBrush);
|
||||
|
||||
public const string SuccessBrush = nameof(SuccessBrush);
|
||||
|
||||
public const string DarkSuccessBrush = nameof(DarkSuccessBrush);
|
||||
|
||||
public const string InfoBrush = nameof(InfoBrush);
|
||||
|
||||
public const string DarkInfoBrush = nameof(DarkInfoBrush);
|
||||
|
||||
public const string DangerBrush = nameof(DangerBrush);
|
||||
|
||||
public const string DarkDangerBrush = nameof(DarkDangerBrush);
|
||||
|
||||
public const string WarningBrush = nameof(WarningBrush);
|
||||
|
||||
public const string DarkWarningBrush = nameof(DarkWarningBrush);
|
||||
|
||||
public const string AccentBrush = nameof(AccentBrush);
|
||||
|
||||
public const string DarkAccentBrush = nameof(DarkAccentBrush);
|
||||
|
||||
public const string PrimaryTextBrush = nameof(PrimaryTextBrush);
|
||||
|
||||
public const string SecondaryTextBrush = nameof(SecondaryTextBrush);
|
||||
|
||||
public const string ThirdlyTextBrush = nameof(ThirdlyTextBrush);
|
||||
|
||||
public const string ReverseTextBrush = nameof(ReverseTextBrush);
|
||||
|
||||
public const string TextIconBrush = nameof(TextIconBrush);
|
||||
|
||||
public const string BorderBrush = nameof(BorderBrush);
|
||||
|
||||
public const string SecondaryBorderBrush = nameof(SecondaryBorderBrush);
|
||||
|
||||
public const string BackgroundBrush = nameof(BackgroundBrush);
|
||||
|
||||
public const string RegionBrush = nameof(RegionBrush);
|
||||
|
||||
public const string SecondaryRegionBrush = nameof(SecondaryRegionBrush);
|
||||
|
||||
public const string ThirdlyRegionBrush = nameof(ThirdlyRegionBrush);
|
||||
|
||||
public const string TitleBrush = nameof(TitleBrush);
|
||||
|
||||
public const string DefaultBrush = nameof(DefaultBrush);
|
||||
|
||||
public const string DarkDefaultBrush = nameof(DarkDefaultBrush);
|
||||
|
||||
public const string DarkMaskBrush = nameof(DarkMaskBrush);
|
||||
|
||||
public const string DarkOpacityBrush = nameof(DarkOpacityBrush);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Converter
|
||||
|
||||
public const string Boolean2BooleanReConverter = nameof(Boolean2BooleanReConverter);
|
||||
|
||||
public const string Boolean2VisibilityReConverter = nameof(Boolean2VisibilityReConverter);
|
||||
|
||||
public const string BooleanArr2VisibilityConverter = nameof(BooleanArr2VisibilityConverter);
|
||||
|
||||
public const string Long2FileSizeConverter = nameof(Long2FileSizeConverter);
|
||||
|
||||
public const string String2VisibilityConverter = nameof(String2VisibilityConverter);
|
||||
|
||||
public const string String2VisibilityReConverter = nameof(String2VisibilityReConverter);
|
||||
|
||||
public const string Boolean2VisibilityConverter = nameof(Boolean2VisibilityConverter);
|
||||
|
||||
public const string TreeViewItemMarginConverter = nameof(TreeViewItemMarginConverter);
|
||||
|
||||
public const string Color2HexStringConverter = nameof(Color2HexStringConverter);
|
||||
|
||||
public const string Object2BooleanConverter = nameof(Object2BooleanConverter);
|
||||
|
||||
public const string Boolean2StringConverter = nameof(Boolean2StringConverter);
|
||||
|
||||
public const string Int2StringConverter = nameof(Int2StringConverter);
|
||||
|
||||
public const string BorderClipConverter = nameof(BorderClipConverter);
|
||||
|
||||
public const string BorderCircularClipConverter = nameof(BorderCircularClipConverter);
|
||||
|
||||
public const string BorderCircularConverter = nameof(BorderCircularConverter);
|
||||
|
||||
public const string Object2VisibilityConverter = nameof(Object2VisibilityConverter);
|
||||
|
||||
public const string Number2PercentageConverter = nameof(Number2PercentageConverter);
|
||||
|
||||
public const string RectangleCircularConverter = nameof(RectangleCircularConverter);
|
||||
|
||||
public const string ThicknessSplitConverter = nameof(ThicknessSplitConverter);
|
||||
|
||||
public const string CornerRadiusSplitConverter = nameof(CornerRadiusSplitConverter);
|
||||
|
||||
public const string MenuScrollingVisibilityConverter = nameof(MenuScrollingVisibilityConverter);
|
||||
|
||||
public const string Double2GridLengthConverter = nameof(Double2GridLengthConverter);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Effect
|
||||
|
||||
public const string EffectShadowColor = nameof(EffectShadowColor);
|
||||
|
||||
public const string EffectShadow1 = nameof(EffectShadow1);
|
||||
|
||||
public const string EffectShadow2 = nameof(EffectShadow2);
|
||||
|
||||
public const string EffectShadow3 = nameof(EffectShadow3);
|
||||
|
||||
public const string EffectShadow4 = nameof(EffectShadow4);
|
||||
|
||||
public const string EffectShadow5 = nameof(EffectShadow5);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Color
|
||||
|
||||
public const string PrimaryColor = nameof(PrimaryColor);
|
||||
|
||||
public const string DarkPrimaryColor = nameof(DarkPrimaryColor);
|
||||
|
||||
public const string DangerColor = nameof(DangerColor);
|
||||
|
||||
public const string DarkDangerColor = nameof(DarkDangerColor);
|
||||
|
||||
public const string WarningColor = nameof(WarningColor);
|
||||
|
||||
public const string DarkWarningColor = nameof(DarkWarningColor);
|
||||
|
||||
public const string InfoColor = nameof(InfoColor);
|
||||
|
||||
public const string DarkInfoColor = nameof(DarkInfoColor);
|
||||
|
||||
public const string SuccessColor = nameof(SuccessColor);
|
||||
|
||||
public const string DarkSuccessColor = nameof(DarkSuccessColor);
|
||||
|
||||
public const string PrimaryTextColor = nameof(PrimaryTextColor);
|
||||
|
||||
public const string SecondaryTextColor = nameof(SecondaryTextColor);
|
||||
|
||||
public const string ThirdlyTextColor = nameof(ThirdlyTextColor);
|
||||
|
||||
public const string ReverseTextColor = nameof(ReverseTextColor);
|
||||
|
||||
public const string TextIconColor = nameof(TextIconColor);
|
||||
|
||||
public const string BorderColor = nameof(BorderColor);
|
||||
|
||||
public const string SecondaryBorderColor = nameof(SecondaryBorderColor);
|
||||
|
||||
public const string BackgroundColor = nameof(BackgroundColor);
|
||||
|
||||
public const string RegionColor = nameof(RegionColor);
|
||||
|
||||
public const string SecondaryRegionColor = nameof(SecondaryRegionColor);
|
||||
|
||||
public const string ThirdlyRegionColor = nameof(ThirdlyRegionColor);
|
||||
|
||||
public const string TitleColor = nameof(TitleColor);
|
||||
|
||||
public const string SecondaryTitleColor = nameof(SecondaryTitleColor);
|
||||
|
||||
public const string DefaultColor = nameof(DefaultColor);
|
||||
|
||||
public const string DarkDefaultColor = nameof(DarkDefaultColor);
|
||||
|
||||
public const string AccentColor = nameof(AccentColor);
|
||||
|
||||
public const string DarkAccentColor = nameof(DarkAccentColor);
|
||||
|
||||
public const string DarkMaskColor = nameof(DarkMaskColor);
|
||||
|
||||
public const string DarkOpacityColor = nameof(DarkOpacityColor);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Behavior
|
||||
|
||||
public const string BehaviorXY200 = nameof(BehaviorXY200);
|
||||
|
||||
public const string BehaviorX200 = nameof(BehaviorX200);
|
||||
|
||||
public const string BehaviorY200 = nameof(BehaviorY200);
|
||||
|
||||
public const string BehaviorXY400 = nameof(BehaviorXY400);
|
||||
|
||||
public const string BehaviorX400 = nameof(BehaviorX400);
|
||||
|
||||
public const string BehaviorY400 = nameof(BehaviorY400);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
|
||||
internal const string BlurGradientValue = nameof(BlurGradientValue);
|
||||
|
||||
internal const string ButtonCustom = nameof(ButtonCustom);
|
||||
@@ -87,7 +349,7 @@
|
||||
internal const string TabItemCapsuleVerticalFirst = nameof(TabItemCapsuleVerticalFirst);
|
||||
|
||||
internal const string TabItemCapsuleVerticalLast = nameof(TabItemCapsuleVerticalLast);
|
||||
|
||||
internal const string BehaviorXY400 = nameof(BehaviorXY400);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,8 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\LinearGeometryKeyFrame.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\ResolvedKeyFrameEntry.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorComplementEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\GrayScaleEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
|
||||
@@ -907,7 +909,7 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Controls\Growl\" />
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Tools\Generator\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)Resources\Effects\ColorComplementEffect.fx" />
|
||||
<None Include="$(MSBuildThisFileDirectory)Resources\Effects\GrayScaleEffect.fx" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
|
||||
namespace HandyControl.Media.Effects
|
||||
{
|
||||
public class ColorComplementEffect : ShaderEffect
|
||||
{
|
||||
public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(ColorComplementEffect), 0);
|
||||
|
||||
private static readonly PixelShader Shader;
|
||||
|
||||
static ColorComplementEffect()
|
||||
{
|
||||
Shader = new PixelShader
|
||||
{
|
||||
UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/ColorComplementEffect.ps")
|
||||
};
|
||||
}
|
||||
|
||||
public ColorComplementEffect()
|
||||
{
|
||||
PixelShader = Shader;
|
||||
|
||||
UpdateShaderValue(InputProperty);
|
||||
}
|
||||
|
||||
public Brush Input
|
||||
{
|
||||
get => (Brush)GetValue(InputProperty);
|
||||
set => SetValue(InputProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Media.Effects
|
||||
{
|
||||
public class GrayScaleEffect : ShaderEffect
|
||||
{
|
||||
public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(GrayScaleEffect), 0);
|
||||
|
||||
private static readonly PixelShader Shader;
|
||||
|
||||
static GrayScaleEffect()
|
||||
{
|
||||
Shader = new PixelShader
|
||||
{
|
||||
UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/GrayScaleEffect.ps")
|
||||
};
|
||||
}
|
||||
|
||||
public GrayScaleEffect()
|
||||
{
|
||||
PixelShader = Shader;
|
||||
|
||||
UpdateShaderValue(InputProperty);
|
||||
UpdateShaderValue(ScaleProperty);
|
||||
}
|
||||
|
||||
public Brush Input
|
||||
{
|
||||
get => (Brush)GetValue(InputProperty);
|
||||
set => SetValue(InputProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
|
||||
"Scale", typeof(double), typeof(GrayScaleEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
|
||||
|
||||
public double Scale
|
||||
{
|
||||
get => (double) GetValue(ScaleProperty);
|
||||
set => SetValue(ScaleProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Expression.Shapes")]
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Expression.Media")]
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Media.Animation")]
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Media.Effects")]
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Data")]
|
||||
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Properties.Langs")]
|
||||
[assembly: XmlnsPrefix("https://handyorg.github.io/handycontrol", "hc")]
|
||||
@@ -0,0 +1,10 @@
|
||||
float4 main(float2 uv : TEXCOORD) : COLOR
|
||||
{
|
||||
float4 color = tex2D(implicitInput, uv);
|
||||
float4 complement;
|
||||
|
||||
complement.rgb = color.a - color.rgb;
|
||||
complement.a = color.a;
|
||||
|
||||
return complement;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
sampler2D implicitInput : register(s0);
|
||||
float scale : register(c0);
|
||||
|
||||
float4 main(float2 uv : TEXCOORD) : COLOR
|
||||
{
|
||||
float4 color = tex2D(implicitInput, uv);
|
||||
|
||||
float4 complement;
|
||||
float intensity = (color.r + color.g + color.b) / 3;
|
||||
|
||||
complement.rgb = color.rgb * (1 - scale) + intensity * scale;
|
||||
complement.a = color.a;
|
||||
|
||||
return complement;
|
||||
}
|
||||
Binary file not shown.
@@ -14,7 +14,7 @@
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="MinHeight" Value="32"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Expander">
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="BaseStyle.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!--默认ListBoxItem样式-->
|
||||
@@ -11,7 +12,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="MinHeight" Value="32"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
|
||||
Reference in new issue
Block a user