init branch

This commit is contained in:
NaBian 2020-07-21 00:43:03 +08:00
parent c6fbffb32e
commit a34a0a9662
8 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,99 @@
using System.Windows;
using System.Windows.Controls;
using HandyControl.Data;
namespace HandyControl.Controls
{
public class FlexPanel : Panel
{
public static readonly DependencyProperty OrderProperty = DependencyProperty.RegisterAttached(
"Order", typeof(int), typeof(FlexPanel), new PropertyMetadata(ValueBoxes.Int0Box));
public static void SetOrder(DependencyObject element, int value)
=> element.SetValue(OrderProperty, value);
public static int GetOrder(DependencyObject element)
=> (int) element.GetValue(OrderProperty);
public static readonly DependencyProperty FlexGrowProperty = DependencyProperty.RegisterAttached(
"FlexGrow", typeof(double), typeof(FlexPanel), new PropertyMetadata(ValueBoxes.Double0Box));
public static void SetFlexGrow(DependencyObject element, double value)
=> element.SetValue(FlexGrowProperty, value);
public static double GetFlexGrow(DependencyObject element)
=> (double) element.GetValue(FlexGrowProperty);
public static readonly DependencyProperty FlexShrinkProperty = DependencyProperty.RegisterAttached(
"FlexShrink", typeof(double), typeof(FlexPanel), new PropertyMetadata(ValueBoxes.Double1Box));
public static void SetFlexShrink(DependencyObject element, double value)
=> element.SetValue(FlexShrinkProperty, value);
public static double GetFlexShrink(DependencyObject element)
=> (double) element.GetValue(FlexShrinkProperty);
public static readonly DependencyProperty FlexBasisProperty = DependencyProperty.RegisterAttached(
"FlexBasis", typeof(double), typeof(FlexPanel), new PropertyMetadata(double.NaN));
public static void SetFlexBasis(DependencyObject element, double value)
=> element.SetValue(FlexBasisProperty, value);
public static double GetFlexBasis(DependencyObject element)
=> (double) element.GetValue(FlexBasisProperty);
public static readonly DependencyProperty AlignSelfProperty = DependencyProperty.RegisterAttached(
"AlignSelf", typeof(FlexItemAlignment), typeof(FlexPanel), new PropertyMetadata(default(FlexItemAlignment)));
public static void SetAlignSelf(DependencyObject element, FlexItemAlignment value)
=> element.SetValue(AlignSelfProperty, value);
public static FlexItemAlignment GetAlignSelf(DependencyObject element)
=> (FlexItemAlignment) element.GetValue(AlignSelfProperty);
public static readonly DependencyProperty FlexDirectionProperty = DependencyProperty.Register(
"FlexDirection", typeof(FlexOrientation), typeof(FlexPanel), new PropertyMetadata(default(FlexOrientation)));
public FlexOrientation FlexDirection
{
get => (FlexOrientation) GetValue(FlexDirectionProperty);
set => SetValue(FlexDirectionProperty, value);
}
public static readonly DependencyProperty FlexWrapProperty = DependencyProperty.Register(
"FlexWrap", typeof(FlexWrapping), typeof(FlexPanel), new PropertyMetadata(default(FlexWrapping)));
public FlexWrapping FlexWrap
{
get => (FlexWrapping) GetValue(FlexWrapProperty);
set => SetValue(FlexWrapProperty, value);
}
public static readonly DependencyProperty JustifyContentProperty = DependencyProperty.Register(
"JustifyContent", typeof(FlexContentJustify), typeof(FlexPanel), new PropertyMetadata(default(FlexContentJustify)));
public FlexContentJustify JustifyContent
{
get => (FlexContentJustify) GetValue(JustifyContentProperty);
set => SetValue(JustifyContentProperty, value);
}
public static readonly DependencyProperty AlignItemsProperty = DependencyProperty.Register(
"AlignItems", typeof(FlexItemsAlignment), typeof(FlexPanel), new PropertyMetadata(default(FlexItemsAlignment)));
public FlexItemsAlignment AlignItems
{
get => (FlexItemsAlignment) GetValue(AlignItemsProperty);
set => SetValue(AlignItemsProperty, value);
}
public static readonly DependencyProperty AlignContentProperty = DependencyProperty.Register(
"AlignContent", typeof(FlexContentAlignment), typeof(FlexPanel), new PropertyMetadata(default(FlexContentAlignment)));
public FlexContentAlignment AlignContent
{
get => (FlexContentAlignment) GetValue(AlignContentProperty);
set => SetValue(AlignContentProperty, value);
}
}
}

View File

@ -0,0 +1,12 @@
namespace HandyControl.Data
{
public enum FlexContentAlignment
{
FlexStart,
FlexEnd,
Center,
SpaceBetween,
SpaceAround,
Stretch
}
}

View File

@ -0,0 +1,11 @@
namespace HandyControl.Data
{
public enum FlexContentJustify
{
FlexStart,
FlexEnd,
Center,
SpaceBetween,
SpaceAround
}
}

View File

@ -0,0 +1,12 @@
namespace HandyControl.Data
{
public enum FlexItemAlignment
{
Auto,
FlexStart,
FlexEnd,
Center,
Baseline,
Stretch
}
}

View File

@ -0,0 +1,11 @@
namespace HandyControl.Data
{
public enum FlexItemsAlignment
{
FlexStart,
FlexEnd,
Center,
Baseline,
Stretch
}
}

View File

@ -0,0 +1,10 @@
namespace HandyControl.Data
{
public enum FlexOrientation
{
Row,
RowReverse,
Column,
ColumnReverse
}
}

View File

@ -0,0 +1,9 @@
namespace HandyControl.Data
{
public enum FlexWrapping
{
NoWrap,
Wrap,
WrapReverse
}
}

View File

@ -44,6 +44,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Notification.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Poptip.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Watermark.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\FlexPanel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\Editors\ImagePropertyEditor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\Editors\VerticalAlignmentPropertyEditor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\Editors\HorizontalAlignmentPropertyEditor.cs" />
@ -73,6 +74,12 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Text\SimpleText.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Window\GlowWindow.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Collections\DateTimeRangeComparer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexContentJustify.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexContentAlignment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexItemAlignment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexItemsAlignment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexOrientation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Flex\FlexWrapping.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Range\DateTimeRange.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\DisposableObject.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\EnumDataProvider.cs" />