Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Jan 1, 2020
2 parents 8e649a9 + c954539 commit b26f3a1
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 20 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ This project is based on [HandyControl](https://github.com/handyOrg/HandyControl
<a href="https://github.com/yangkang326" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/51224259?s=400&v=4"></a>
<a href="https://github.com/zmrbak" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/7257543?s=400&v=4"></a>
<a href="https://github.com/AFei19911012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/31465314?s=400&v=4"></a>
<a href="https://github.com/wayne2006" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/21210915?s=400&v=4"></a>
<a href="https://github.com/towerDLH" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/53053537?s=400&v=4"></a>

## Special thanks to

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid},Converter={StaticResource DoubleMinConverter}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="1"/>
<ScrollBar Style="{StaticResource ScrollBarBaseStyle}" Opacity="0" x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Net_40/HandyControl_Net_40/Themes/Styles/DataGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid},Converter={StaticResource DoubleMinConverter}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="1"/>
<ScrollBar Style="{StaticResource ScrollBarBaseStyle}" Opacity="0" x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<Button Command="{x:Static DataGrid.SelectAllCommand}" Margin="0,0,0,6" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType=DataGrid},Converter={StaticResource DoubleMinConverter}}" Style="{StaticResource ButtonIcon}" controls:IconElement.Geometry="{StaticResource AllGeometry}" Foreground="{DynamicResource PrimaryBrush}"/>
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="3" Grid.Column="0" Grid.Row="1"/>
<ScrollBar Style="{StaticResource ScrollBarBaseStyle}" Opacity="0" x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
Expand Down
5 changes: 3 additions & 2 deletions src/Shared/HandyControlDemo_Shared/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ namespace HandyControlDemo
{
public partial class App
{
// ReSharper disable once NotAccessedField.Local
[SuppressMessage("代码质量", "IDE0052:删除未读的私有成员", Justification = "<挂起>")]
#pragma warning disable IDE0052
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
private static Mutex AppMutex;
#pragma warning restore IDE0052

protected override void OnStartup(StartupEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class String2BrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is string str ? ResourceHelper.GetResource<Brush>(str) : default(Brush);
return value is string str ? ResourceHelper.GetResource<Brush>(str) : default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public override void OnApplyTemplate()
if (_passwordChar != default(char))
{
ActualPasswordBox.PasswordChar = _passwordChar;
_passwordChar = default(char);
_passwordChar = default;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Shared/HandyControl_Shared/Data/ColorRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void Update()
/// <returns></returns>
public Color GetColor(double range)
{
if (range < 0 || range > 1) return default(Color);
if (range < 0 || range > 1) return default;
return Color.FromArgb((byte)(_color1.A - _subColorArr[0] * range), (byte)(_color1.R - _subColorArr[1] * range),
(byte)(_color1.G - _subColorArr[2] * range), (byte)(_color1.B - _subColorArr[3] * range));
}
Expand Down
2 changes: 2 additions & 0 deletions src/Shared/HandyControl_Shared/Data/ResourceToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public class ResourceToken

public const string Double2GridLengthConverter = nameof(Double2GridLengthConverter);

public const string DoubleMinConverter = nameof(DoubleMinConverter);

#endregion

#region Effect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public static bool EnsureListCountAtLeast<T>(this IList<T> list, int count, Func
return false;
}

if ((list is List<T> list2) && (factory == null))
if ((list is List<T> list2) && factory == null)
{
list2.AddRange(new T[count - list.Count]);
}
else
{
for (var i = list.Count; i < count; i++)
{
list.Add((factory == null) ? default(T) : factory());
list.Add(factory == null ? default : factory());
}
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Double2GridLengthConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\DoubleMinConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ProgressBarWidthConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\RectangleCircularConverter.cs" />
Expand Down Expand Up @@ -997,8 +998,7 @@
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Controls\Extra\Navigation\" />
<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>
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
<converter:CornerRadiusSplitConverter x:Key="CornerRadiusSplitConverter"/>
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
<converter:Double2GridLengthConverter x:Key="Double2GridLengthConverter" />
<converter:DoubleMinConverter x:Key="DoubleMinConverter" />
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
}
catch
{
return new SolidColorBrush(default(Color));
return new SolidColorBrush(default);
}
return new SolidColorBrush(default(Color));
return new SolidColorBrush(default);
}
return new SolidColorBrush(default(Color));
return new SolidColorBrush(default);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Globalization;
using System.Windows.Data;
using HandyControl.Tools.Extension;

namespace HandyControl.Tools.Converter
{
public class DoubleMinConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double doubleValue)
{
if (parameter is string str)
{
var minValue = str.Value<double>();
return doubleValue < minValue ? minValue : doubleValue;
}

return doubleValue < .0 ? .0 : doubleValue;
}

return .0;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static T Value<T>(this string input)
}
catch
{
return default(T);
return default;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static T GetResource<T>(string key)
return resource;
}

return default(T);
return default;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SingleOpenHelper
{
var typeStr = typeof(T).FullName;

if (string.IsNullOrEmpty(typeStr)) return default(T);
if (string.IsNullOrEmpty(typeStr)) return default;

var temp = new T();
if (!OpenDic.Keys.Contains(typeStr))
Expand All @@ -36,7 +36,7 @@ public class SingleOpenHelper
OpenDic[typeStr] = temp;
return temp;
}
return default(T);
return default;
}
}
}

0 comments on commit b26f3a1

Please sign in to comment.