chore: add avalonia border demo.
This commit is contained in:
1 parent
40bb60164e
commit
17c2b8473b
8 files changed
+248
-73
No files matched your search
@@ -61,6 +61,10 @@
|
|||||||
<DependentUpon>BoderDemoCtl.axaml</DependentUpon>
|
<DependentUpon>BoderDemoCtl.axaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="UserControl\Styles\BorderDemoCtl.axaml.cs">
|
||||||
|
<DependentUpon>BorderDemoCtl.axaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
CornerRadius="10,10,0,0"
|
CornerRadius="10,10,0,0"
|
||||||
Background="{DynamicResource TitleBrush}"
|
Background="{DynamicResource TitleBrush}"
|
||||||
Classes="clip">
|
Theme="{StaticResource BorderClip}">
|
||||||
<Panel>
|
<Panel>
|
||||||
<TextBlock Foreground="White"
|
<TextBlock Foreground="White"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
x:Class="HandyControlDemo.UserControl.BorderDemoCtl"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<ScrollViewer>
|
||||||
|
<hc:UniformSpacingPanel Margin="32"
|
||||||
|
Orientation="Vertical"
|
||||||
|
Spacing="32"
|
||||||
|
MaxWidth="664">
|
||||||
|
<hc:UniformSpacingPanel Spacing="32"
|
||||||
|
ItemWidth="200"
|
||||||
|
ItemHeight="200"
|
||||||
|
ChildWrapping="Wrap"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<Border Theme="{StaticResource BorderRegion}">
|
||||||
|
<Border Background="{DynamicResource PrimaryBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="White" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderRegion}"
|
||||||
|
Effect="{StaticResource EffectShadow1}">
|
||||||
|
<Border Background="{DynamicResource InfoBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="White" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderRegion}"
|
||||||
|
Effect="{StaticResource EffectShadow2}">
|
||||||
|
<Border Background="{DynamicResource WarningBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="White" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderRegion}"
|
||||||
|
Effect="{StaticResource EffectShadow3}">
|
||||||
|
<Border Background="{DynamicResource DangerBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="White" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderRegion}"
|
||||||
|
Effect="{StaticResource EffectShadow4}">
|
||||||
|
<Border Background="{DynamicResource AccentBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="White" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderRegion}"
|
||||||
|
Effect="{StaticResource EffectShadow5}">
|
||||||
|
<Border Background="{DynamicResource BorderBrush}">
|
||||||
|
<TextBlock Text="Content"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Orientation="Vertical"
|
||||||
|
Spacing="10">
|
||||||
|
<Border Theme="{StaticResource BorderTipPrimary}">
|
||||||
|
<TextBlock Text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderTipDanger}">
|
||||||
|
<TextBlock Text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderTipWarning}">
|
||||||
|
<TextBlock Text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderTipInfo}">
|
||||||
|
<TextBlock Text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||||
|
</Border>
|
||||||
|
<Border Theme="{StaticResource BorderTipSuccess}">
|
||||||
|
<TextBlock Text="TitleTitleTitleTitleTitleTitleTitleTitleTitleTitle" />
|
||||||
|
</Border>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace HandyControlDemo.UserControl;
|
||||||
|
|
||||||
|
public partial class BorderDemoCtl : Avalonia.Controls.UserControl
|
||||||
|
{
|
||||||
|
public BorderDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@ namespace HandyControl.Controls;
|
|||||||
public class UniformSpacingPanel : Panel
|
public class UniformSpacingPanel : Panel
|
||||||
{
|
{
|
||||||
public static readonly StyledProperty<Orientation> OrientationProperty =
|
public static readonly StyledProperty<Orientation> OrientationProperty =
|
||||||
StackPanel.OrientationProperty.AddOwner<UniformSpacingPanel>();
|
StackPanel.OrientationProperty.AddOwner<UniformSpacingPanel>(new StyledPropertyMetadata<Orientation>(
|
||||||
|
defaultValue: Orientation.Horizontal));
|
||||||
|
|
||||||
public static readonly StyledProperty<VisualWrapping> ChildWrappingProperty =
|
public static readonly StyledProperty<VisualWrapping> ChildWrappingProperty =
|
||||||
AvaloniaProperty.Register<UniformSpacingPanel, VisualWrapping>(nameof(ChildWrapping));
|
AvaloniaProperty.Register<UniformSpacingPanel, VisualWrapping>(nameof(ChildWrapping));
|
||||||
@@ -43,8 +44,6 @@ public class UniformSpacingPanel : Panel
|
|||||||
AvaloniaProperty.Register<UniformSpacingPanel, VerticalAlignment?>(nameof(ItemVerticalAlignment),
|
AvaloniaProperty.Register<UniformSpacingPanel, VerticalAlignment?>(nameof(ItemVerticalAlignment),
|
||||||
defaultValue: VerticalAlignment.Stretch);
|
defaultValue: VerticalAlignment.Stretch);
|
||||||
|
|
||||||
private Orientation _orientation = Orientation.Horizontal;
|
|
||||||
|
|
||||||
static UniformSpacingPanel()
|
static UniformSpacingPanel()
|
||||||
{
|
{
|
||||||
AffectsMeasure<StackPanel>(OrientationProperty);
|
AffectsMeasure<StackPanel>(OrientationProperty);
|
||||||
@@ -56,16 +55,6 @@ public class UniformSpacingPanel : Panel
|
|||||||
AffectsMeasure<StackPanel>(ItemHeightProperty);
|
AffectsMeasure<StackPanel>(ItemHeightProperty);
|
||||||
AffectsMeasure<StackPanel>(ItemHorizontalAlignmentProperty);
|
AffectsMeasure<StackPanel>(ItemHorizontalAlignmentProperty);
|
||||||
AffectsMeasure<StackPanel>(ItemVerticalAlignmentProperty);
|
AffectsMeasure<StackPanel>(ItemVerticalAlignmentProperty);
|
||||||
|
|
||||||
OrientationProperty.Changed.AddClassHandler<UniformSpacingPanel>(OnOrientationChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void OnOrientationChanged(UniformSpacingPanel self, AvaloniaPropertyChangedEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.NewValue is Orientation orientation)
|
|
||||||
{
|
|
||||||
self._orientation = orientation;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double CoerceLength(AvaloniaObject _, double length) => length < 0 ? 0 : length;
|
private static double CoerceLength(AvaloniaObject _, double length) => length < 0 ? 0 : length;
|
||||||
@@ -126,9 +115,10 @@ public class UniformSpacingPanel : Panel
|
|||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
var curLineSize = new PanelUvSize(_orientation);
|
var orientation = Orientation;
|
||||||
var panelSize = new PanelUvSize(_orientation);
|
var curLineSize = new PanelUvSize(orientation);
|
||||||
var uvConstraint = new PanelUvSize(_orientation, availableSize);
|
var panelSize = new PanelUvSize(orientation);
|
||||||
|
var uvConstraint = new PanelUvSize(orientation, availableSize);
|
||||||
double itemWidth = ItemWidth;
|
double itemWidth = ItemWidth;
|
||||||
double itemHeight = ItemHeight;
|
double itemHeight = ItemHeight;
|
||||||
bool itemWidthSet = !double.IsNaN(itemWidth);
|
bool itemWidthSet = !double.IsNaN(itemWidth);
|
||||||
@@ -148,15 +138,15 @@ public class UniformSpacingPanel : Panel
|
|||||||
|
|
||||||
if (childWrapping == VisualWrapping.NoWrap)
|
if (childWrapping == VisualWrapping.NoWrap)
|
||||||
{
|
{
|
||||||
var layoutSlotSize = new PanelUvSize(_orientation, availableSize);
|
var layoutSlotSize = new PanelUvSize(orientation, availableSize);
|
||||||
|
|
||||||
if (_orientation == Orientation.Horizontal)
|
if (orientation == Orientation.Horizontal)
|
||||||
{
|
{
|
||||||
layoutSlotSize.U = double.PositiveInfinity;
|
layoutSlotSize.V = double.PositiveInfinity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
layoutSlotSize.V = double.PositiveInfinity;
|
layoutSlotSize.U = double.PositiveInfinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, count = Children.Count; i < count; ++i)
|
for (int i = 0, count = Children.Count; i < count; ++i)
|
||||||
@@ -176,7 +166,7 @@ public class UniformSpacingPanel : Panel
|
|||||||
child.Measure(new Size(layoutSlotSize.Width, layoutSlotSize.Height));
|
child.Measure(new Size(layoutSlotSize.Width, layoutSlotSize.Height));
|
||||||
|
|
||||||
var sz = new PanelUvSize(
|
var sz = new PanelUvSize(
|
||||||
_orientation,
|
orientation,
|
||||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||||
|
|
||||||
@@ -205,30 +195,23 @@ public class UniformSpacingPanel : Panel
|
|||||||
child.Measure(childConstraint);
|
child.Measure(childConstraint);
|
||||||
|
|
||||||
var sz = new PanelUvSize(
|
var sz = new PanelUvSize(
|
||||||
_orientation,
|
orientation,
|
||||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvConstraint.U))
|
if (!isFirst && MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvConstraint.U))
|
||||||
{
|
{
|
||||||
panelSize.U = Math.Max(curLineSize.U, panelSize.U);
|
panelSize.U = Math.Max(curLineSize.U, panelSize.U);
|
||||||
panelSize.V += curLineSize.V + spacingSize.V;
|
panelSize.V += curLineSize.V + spacingSize.V;
|
||||||
curLineSize = sz;
|
curLineSize = sz;
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(sz.U, uvConstraint.U))
|
|
||||||
{
|
|
||||||
panelSize.U = Math.Max(sz.U, panelSize.U);
|
|
||||||
panelSize.V += sz.V + spacingSize.V;
|
|
||||||
curLineSize = new PanelUvSize(_orientation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curLineSize.U += isFirst ? sz.U : sz.U + spacingSize.U;
|
curLineSize.U += isFirst ? sz.U : sz.U + spacingSize.U;
|
||||||
curLineSize.V = Math.Max(sz.V, curLineSize.V);
|
curLineSize.V = Math.Max(sz.V, curLineSize.V);
|
||||||
|
|
||||||
isFirst = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,16 +223,17 @@ public class UniformSpacingPanel : Panel
|
|||||||
|
|
||||||
protected override Size ArrangeOverride(Size finalSize)
|
protected override Size ArrangeOverride(Size finalSize)
|
||||||
{
|
{
|
||||||
|
var orientation = Orientation;
|
||||||
int firstInLine = 0;
|
int firstInLine = 0;
|
||||||
double itemWidth = ItemWidth;
|
double itemWidth = ItemWidth;
|
||||||
double itemHeight = ItemHeight;
|
double itemHeight = ItemHeight;
|
||||||
double accumulatedV = 0;
|
double accumulatedV = 0;
|
||||||
double itemU = _orientation == Orientation.Horizontal ? itemWidth : itemHeight;
|
double itemU = orientation == Orientation.Horizontal ? itemWidth : itemHeight;
|
||||||
var curLineSize = new PanelUvSize(_orientation);
|
var curLineSize = new PanelUvSize(orientation);
|
||||||
var uvFinalSize = new PanelUvSize(_orientation, finalSize);
|
var uvFinalSize = new PanelUvSize(orientation, finalSize);
|
||||||
bool itemWidthSet = !double.IsNaN(itemWidth);
|
bool itemWidthSet = !double.IsNaN(itemWidth);
|
||||||
bool itemHeightSet = !double.IsNaN(itemHeight);
|
bool itemHeightSet = !double.IsNaN(itemHeight);
|
||||||
bool useItemU = _orientation == Orientation.Horizontal ? itemWidthSet : itemHeightSet;
|
bool useItemU = orientation == Orientation.Horizontal ? itemWidthSet : itemHeightSet;
|
||||||
var childWrapping = ChildWrapping;
|
var childWrapping = ChildWrapping;
|
||||||
var spacingSize = GetSpacingSize();
|
var spacingSize = GetSpacingSize();
|
||||||
|
|
||||||
@@ -266,13 +250,14 @@ public class UniformSpacingPanel : Panel
|
|||||||
var child = Children[i];
|
var child = Children[i];
|
||||||
|
|
||||||
var sz = new PanelUvSize(
|
var sz = new PanelUvSize(
|
||||||
_orientation,
|
orientation,
|
||||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(curLineSize.U + (isFirst ? sz.U : sz.U + spacingSize.U), uvFinalSize.U))
|
if (!isFirst && MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvFinalSize.U))
|
||||||
{
|
{
|
||||||
ArrangeWrapLine(accumulatedV, curLineSize.V, firstInLine, i, useItemU, itemU, spacingSize.U);
|
ArrangeWrapLine(orientation, accumulatedV, curLineSize.V, firstInLine, i, useItemU, itemU,
|
||||||
|
spacingSize.U);
|
||||||
|
|
||||||
accumulatedV += curLineSize.V + spacingSize.V;
|
accumulatedV += curLineSize.V + spacingSize.V;
|
||||||
curLineSize = sz;
|
curLineSize = sz;
|
||||||
@@ -290,7 +275,7 @@ public class UniformSpacingPanel : Panel
|
|||||||
|
|
||||||
if (firstInLine < Children.Count)
|
if (firstInLine < Children.Count)
|
||||||
{
|
{
|
||||||
ArrangeWrapLine(accumulatedV, curLineSize.V, firstInLine, Children.Count, useItemU, itemU,
|
ArrangeWrapLine(orientation, accumulatedV, curLineSize.V, firstInLine, Children.Count, useItemU, itemU,
|
||||||
spacingSize.U);
|
spacingSize.U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,11 +285,12 @@ public class UniformSpacingPanel : Panel
|
|||||||
|
|
||||||
private PanelUvSize GetSpacingSize()
|
private PanelUvSize GetSpacingSize()
|
||||||
{
|
{
|
||||||
|
var orientation = Orientation;
|
||||||
double spacing = Spacing;
|
double spacing = Spacing;
|
||||||
|
|
||||||
if (!double.IsNaN(spacing))
|
if (!double.IsNaN(spacing))
|
||||||
{
|
{
|
||||||
return new PanelUvSize(_orientation, spacing, spacing);
|
return new PanelUvSize(orientation, spacing, spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
double horizontalSpacing = HorizontalSpacing;
|
double horizontalSpacing = HorizontalSpacing;
|
||||||
@@ -319,19 +305,20 @@ public class UniformSpacingPanel : Panel
|
|||||||
verticalSpacing = 0;
|
verticalSpacing = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PanelUvSize(_orientation, horizontalSpacing, verticalSpacing);
|
return new PanelUvSize(orientation, horizontalSpacing, verticalSpacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ArrangeLine(double lineV, bool useItemU, double itemU, double spacing)
|
private void ArrangeLine(double lineV, bool useItemU, double itemU, double spacing)
|
||||||
{
|
{
|
||||||
|
var orientation = Orientation;
|
||||||
double u = 0;
|
double u = 0;
|
||||||
bool isHorizontal = _orientation == Orientation.Horizontal;
|
bool isHorizontal = orientation == Orientation.Horizontal;
|
||||||
|
|
||||||
// ReSharper disable once ForCanBeConvertedToForeach
|
// ReSharper disable once ForCanBeConvertedToForeach
|
||||||
for (int i = 0; i < Children.Count; i++)
|
for (int i = 0; i < Children.Count; i++)
|
||||||
{
|
{
|
||||||
Control child = Children[i];
|
Control child = Children[i];
|
||||||
var childSize = new PanelUvSize(_orientation, child.DesiredSize);
|
var childSize = new PanelUvSize(orientation, child.DesiredSize);
|
||||||
double layoutSlotU = useItemU ? itemU : childSize.U;
|
double layoutSlotU = useItemU ? itemU : childSize.U;
|
||||||
|
|
||||||
child.Arrange(isHorizontal ? new Rect(u, 0, layoutSlotU, lineV) : new Rect(0, u, lineV, layoutSlotU));
|
child.Arrange(isHorizontal ? new Rect(u, 0, layoutSlotU, lineV) : new Rect(0, u, lineV, layoutSlotU));
|
||||||
@@ -344,6 +331,7 @@ public class UniformSpacingPanel : Panel
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ArrangeWrapLine(
|
private void ArrangeWrapLine(
|
||||||
|
Orientation orientation,
|
||||||
double v,
|
double v,
|
||||||
double lineV,
|
double lineV,
|
||||||
int start,
|
int start,
|
||||||
@@ -353,13 +341,13 @@ public class UniformSpacingPanel : Panel
|
|||||||
double spacing)
|
double spacing)
|
||||||
{
|
{
|
||||||
double u = 0;
|
double u = 0;
|
||||||
bool isHorizontal = _orientation == Orientation.Horizontal;
|
bool isHorizontal = orientation == Orientation.Horizontal;
|
||||||
|
|
||||||
for (int i = start; i < end; i++)
|
for (int i = start; i < end; i++)
|
||||||
{
|
{
|
||||||
var child = Children[i];
|
var child = Children[i];
|
||||||
|
|
||||||
var childSize = new PanelUvSize(_orientation, child.DesiredSize);
|
var childSize = new PanelUvSize(orientation, child.DesiredSize);
|
||||||
double layoutSlotU = useItemU ? itemU : childSize.U;
|
double layoutSlotU = useItemU ? itemU : childSize.U;
|
||||||
|
|
||||||
child.Arrange(isHorizontal ? new Rect(u, v, layoutSlotU, lineV) : new Rect(v, u, lineV, layoutSlotU));
|
child.Arrange(isHorizontal ? new Rect(u, v, layoutSlotU, lineV) : new Rect(v, u, lineV, layoutSlotU));
|
||||||
|
|||||||
@@ -5,26 +5,31 @@
|
|||||||
|
|
||||||
<DropShadowEffect x:Key="EffectShadow1"
|
<DropShadowEffect x:Key="EffectShadow1"
|
||||||
BlurRadius="5"
|
BlurRadius="5"
|
||||||
|
OffsetX="0"
|
||||||
OffsetY="1"
|
OffsetY="1"
|
||||||
Color="{StaticResource EffectShadowColor}"
|
Color="{StaticResource EffectShadowColor}"
|
||||||
Opacity=".2" />
|
Opacity=".2" />
|
||||||
<DropShadowEffect x:Key="EffectShadow2"
|
<DropShadowEffect x:Key="EffectShadow2"
|
||||||
BlurRadius="8"
|
BlurRadius="8"
|
||||||
|
OffsetX="0"
|
||||||
OffsetY="1.5"
|
OffsetY="1.5"
|
||||||
Color="{StaticResource EffectShadowColor}"
|
Color="{StaticResource EffectShadowColor}"
|
||||||
Opacity=".2" />
|
Opacity=".2" />
|
||||||
<DropShadowEffect x:Key="EffectShadow3"
|
<DropShadowEffect x:Key="EffectShadow3"
|
||||||
BlurRadius="14"
|
BlurRadius="14"
|
||||||
|
OffsetX="0"
|
||||||
OffsetY="4.5"
|
OffsetY="4.5"
|
||||||
Color="{StaticResource EffectShadowColor}"
|
Color="{StaticResource EffectShadowColor}"
|
||||||
Opacity=".2" />
|
Opacity=".2" />
|
||||||
<DropShadowEffect x:Key="EffectShadow4"
|
<DropShadowEffect x:Key="EffectShadow4"
|
||||||
BlurRadius="25"
|
BlurRadius="25"
|
||||||
|
OffsetX="0"
|
||||||
OffsetY="8"
|
OffsetY="8"
|
||||||
Color="{StaticResource EffectShadowColor}"
|
Color="{StaticResource EffectShadowColor}"
|
||||||
Opacity=".2" />
|
Opacity=".2" />
|
||||||
<DropShadowEffect x:Key="EffectShadow5"
|
<DropShadowEffect x:Key="EffectShadow5"
|
||||||
BlurRadius="35"
|
BlurRadius="35"
|
||||||
|
OffsetX="0"
|
||||||
OffsetY="13"
|
OffsetY="13"
|
||||||
Color="{StaticResource EffectShadowColor}"
|
Color="{StaticResource EffectShadowColor}"
|
||||||
Opacity=".2" />
|
Opacity=".2" />
|
||||||
|
|||||||
@@ -1,20 +1,107 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<ControlTheme x:Key="{x:Type Border}"
|
<ControlTheme x:Key="BorderRegion"
|
||||||
TargetType="Border">
|
TargetType="Border">
|
||||||
<Style Selector="^.clip">
|
<Setter Property="CornerRadius"
|
||||||
<Setter Property="Clip">
|
Value="{StaticResource DefaultCornerRadius}" />
|
||||||
<Setter.Value>
|
<Setter Property="Padding"
|
||||||
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
Value="10" />
|
||||||
<Binding Path="ActualWidth"
|
<Setter Property="Background"
|
||||||
RelativeSource="{RelativeSource Self}" />
|
Value="{DynamicResource RegionBrush}" />
|
||||||
<Binding Path="ActualHeight"
|
<Setter Property="BorderThickness"
|
||||||
RelativeSource="{RelativeSource Self}" />
|
Value="1" />
|
||||||
<Binding Path="CornerRadius"
|
<Setter Property="BorderBrush"
|
||||||
RelativeSource="{RelativeSource Self}" />
|
Value="{DynamicResource BorderBrush}" />
|
||||||
</MultiBinding>
|
</ControlTheme>
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
<ControlTheme x:Key="BorderTipBaseStyle"
|
||||||
</Style>
|
TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius"
|
||||||
|
Value="{StaticResource DefaultCornerRadius}" />
|
||||||
|
<Setter Property="Padding"
|
||||||
|
Value="10" />
|
||||||
|
<Setter Property="BorderThickness"
|
||||||
|
Value="5,0,0,0" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderTipPrimary"
|
||||||
|
BasedOn="{StaticResource BorderTipBaseStyle}"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource LightPrimaryBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderTipDanger"
|
||||||
|
BasedOn="{StaticResource BorderTipBaseStyle}"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource LightDangerBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource DangerBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderTipWarning"
|
||||||
|
BasedOn="{StaticResource BorderTipBaseStyle}"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource LightWarningBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource WarningBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderTipInfo"
|
||||||
|
BasedOn="{StaticResource BorderTipBaseStyle}"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource LightInfoBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource InfoBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderTipSuccess"
|
||||||
|
BasedOn="{StaticResource BorderTipBaseStyle}"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource LightSuccessBrush}" />
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource SuccessBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderVerticallySplitter"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="1" />
|
||||||
|
<Setter Property="HorizontalAlignment"
|
||||||
|
Value="Left" />
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource ThirdlyTextBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderHorizontallySplitter"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="1" />
|
||||||
|
<Setter Property="VerticalAlignment"
|
||||||
|
Value="Top" />
|
||||||
|
<Setter Property="Background"
|
||||||
|
Value="{DynamicResource ThirdlyTextBrush}" />
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="BorderClip"
|
||||||
|
TargetType="Border">
|
||||||
|
<Setter Property="Clip">
|
||||||
|
<Setter.Value>
|
||||||
|
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
||||||
|
<Binding Path="Bounds.Width"
|
||||||
|
RelativeSource="{RelativeSource Self}" />
|
||||||
|
<Binding Path="Bounds.Height"
|
||||||
|
RelativeSource="{RelativeSource Self}" />
|
||||||
|
<Binding Path="CornerRadius"
|
||||||
|
RelativeSource="{RelativeSource Self}" />
|
||||||
|
</MultiBinding>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -263,26 +263,19 @@ public class UniformSpacingPanel : Panel
|
|||||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvConstraint.U))
|
if (!isFirst && MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvConstraint.U))
|
||||||
{
|
{
|
||||||
panelSize.U = Math.Max(curLineSize.U, panelSize.U);
|
panelSize.U = Math.Max(curLineSize.U, panelSize.U);
|
||||||
panelSize.V += curLineSize.V + spacingSize.V;
|
panelSize.V += curLineSize.V + spacingSize.V;
|
||||||
curLineSize = sz;
|
curLineSize = sz;
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(sz.U, uvConstraint.U))
|
|
||||||
{
|
|
||||||
panelSize.U = Math.Max(sz.U, panelSize.U);
|
|
||||||
panelSize.V += sz.V + spacingSize.V;
|
|
||||||
curLineSize = new PanelUvSize(_orientation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curLineSize.U += isFirst ? sz.U : sz.U + spacingSize.U;
|
curLineSize.U += isFirst ? sz.U : sz.U + spacingSize.U;
|
||||||
curLineSize.V = Math.Max(sz.V, curLineSize.V);
|
curLineSize.V = Math.Max(sz.V, curLineSize.V);
|
||||||
|
|
||||||
isFirst = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFirst = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +343,7 @@ public class UniformSpacingPanel : Panel
|
|||||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||||
|
|
||||||
if (MathHelper.GreaterThan(curLineSize.U + (isFirst ? sz.U : sz.U + spacingSize.U), uvFinalSize.U))
|
if (!isFirst && MathHelper.GreaterThan(curLineSize.U + sz.U + spacingSize.U, uvFinalSize.U))
|
||||||
{
|
{
|
||||||
ArrangeWrapLine(accumulatedV, curLineSize.V, firstInLine, i, useItemU, itemU, spacingSize.U);
|
ArrangeWrapLine(accumulatedV, curLineSize.V, firstInLine, i, useItemU, itemU, spacingSize.U);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user