diff --git a/EleCho.WpfSuite.FluentDesign/EleCho.WpfSuite.FluentDesign.csproj b/EleCho.WpfSuite.FluentDesign/EleCho.WpfSuite.FluentDesign.csproj
index 7b039d2..3521cc7 100644
--- a/EleCho.WpfSuite.FluentDesign/EleCho.WpfSuite.FluentDesign.csproj
+++ b/EleCho.WpfSuite.FluentDesign/EleCho.WpfSuite.FluentDesign.csproj
@@ -24,10 +24,6 @@
-
-
-
-
Designer
diff --git a/EleCho.WpfSuite/Controls/Border.cs b/EleCho.WpfSuite/Controls/Border.cs
index 18a3333..e28cd0e 100644
--- a/EleCho.WpfSuite/Controls/Border.cs
+++ b/EleCho.WpfSuite/Controls/Border.cs
@@ -53,7 +53,6 @@ public Geometry ContentClip
contentGeometry.Freeze();
return contentGeometry;
-
}
else
{
@@ -62,10 +61,36 @@ public Geometry ContentClip
}
///
- protected override void OnRender(DrawingContext dc)
+ protected override Size ArrangeOverride(Size finalSize)
{
SetValue(ContentClipPropertyKey, CalculateContentClip());
- base.OnRender(dc);
+
+ return base.ArrangeOverride(finalSize);
+ }
+
+ ///
+ protected override Geometry GetLayoutClip(Size layoutSlotSize)
+ {
+ var borderThickness = BorderThickness;
+ var cornerRadius = CornerRadius;
+ var renderSize = RenderSize;
+
+ if (renderSize.Width > 0 && renderSize.Height > 0)
+ {
+ var rect = new Rect(0, 0, renderSize.Width, renderSize.Height);
+ var radii = new Radii(cornerRadius, borderThickness, true);
+
+ var layoutGeometry = new StreamGeometry();
+ using StreamGeometryContext ctx = layoutGeometry.Open();
+ GenerateGeometry(ctx, rect, radii);
+
+ layoutGeometry.Freeze();
+ return layoutGeometry;
+ }
+ else
+ {
+ return base.GetLayoutClip(layoutSlotSize);
+ }
}
///
@@ -200,10 +225,10 @@ private struct Radii
{
internal Radii(CornerRadius radii, Thickness borders, bool outer)
{
- double left = 0.5 * borders.Left;
- double top = 0.5 * borders.Top;
- double right = 0.5 * borders.Right;
- double bottom = 0.5 * borders.Bottom;
+ double left = 0.5 * borders.Left;
+ double top = 0.5 * borders.Top;
+ double right = 0.5 * borders.Right;
+ double bottom = 0.5 * borders.Bottom;
if (outer)
{
diff --git a/WpfTest/Tests/TempPage.xaml b/WpfTest/Tests/TempPage.xaml
index a7d43b7..28eb8b0 100644
--- a/WpfTest/Tests/TempPage.xaml
+++ b/WpfTest/Tests/TempPage.xaml
@@ -251,7 +251,14 @@
-
+
+
+