Skip to content

Commit 570ef76

Browse files
[C] fix BP declaration for Border (#8047)
- fixes #7744
1 parent 67c1bf5 commit 570ef76

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

src/Controls/src/Core/Border.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,29 @@ public Thickness Padding
3636
}
3737

3838
public static readonly BindableProperty StrokeShapeProperty =
39-
BindableProperty.Create(nameof(StrokeShape), typeof(IShape), typeof(Layout), null);
39+
BindableProperty.Create(nameof(StrokeShape), typeof(IShape), typeof(Border), null);
4040

4141
public static readonly BindableProperty StrokeProperty =
42-
BindableProperty.Create(nameof(Stroke), typeof(Brush), typeof(Layout), null);
42+
BindableProperty.Create(nameof(Stroke), typeof(Brush), typeof(Border), null);
4343

4444
public static readonly BindableProperty StrokeThicknessProperty =
45-
BindableProperty.Create(nameof(StrokeThickness), typeof(double), typeof(Layout), 1.0, propertyChanged: StrokeThicknessChanged);
45+
BindableProperty.Create(nameof(StrokeThickness), typeof(double), typeof(Border), 1.0, propertyChanged: StrokeThicknessChanged);
4646

4747
public static readonly BindableProperty StrokeDashArrayProperty =
48-
BindableProperty.Create(nameof(StrokeDashArray), typeof(DoubleCollection), typeof(Layout), null,
48+
BindableProperty.Create(nameof(StrokeDashArray), typeof(DoubleCollection), typeof(Border), null,
4949
defaultValueCreator: bindable => new DoubleCollection());
5050

5151
public static readonly BindableProperty StrokeDashOffsetProperty =
52-
BindableProperty.Create(nameof(StrokeDashOffset), typeof(double), typeof(Layout), 0.0);
52+
BindableProperty.Create(nameof(StrokeDashOffset), typeof(double), typeof(Border), 0.0);
5353

5454
public static readonly BindableProperty StrokeLineCapProperty =
55-
BindableProperty.Create(nameof(StrokeLineCap), typeof(PenLineCap), typeof(Layout), PenLineCap.Flat);
55+
BindableProperty.Create(nameof(StrokeLineCap), typeof(PenLineCap), typeof(Border), PenLineCap.Flat);
5656

5757
public static readonly BindableProperty StrokeLineJoinProperty =
58-
BindableProperty.Create(nameof(StrokeLineJoin), typeof(PenLineJoin), typeof(Layout), PenLineJoin.Miter);
58+
BindableProperty.Create(nameof(StrokeLineJoin), typeof(PenLineJoin), typeof(Border), PenLineJoin.Miter);
5959

6060
public static readonly BindableProperty StrokeMiterLimitProperty =
61-
BindableProperty.Create(nameof(StrokeMiterLimit), typeof(double), typeof(Layout), 10.0);
61+
BindableProperty.Create(nameof(StrokeMiterLimit), typeof(double), typeof(Border), 10.0);
6262

6363
[System.ComponentModel.TypeConverter(typeof(StrokeShapeTypeConverter))]
6464
public IShape? StrokeShape
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests"
5+
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Maui7744">
6+
7+
<StackLayout>
8+
<Border x:Name="border0" StrokeShape="RoundRectangle 1,1,1,1"/>
9+
<Border x:Name="border1">
10+
<Border.Style>
11+
<Style TargetType="Border">
12+
<Setter Property="StrokeShape" Value="RoundRectangle 1,1,1,1"/>
13+
</Style>
14+
</Border.Style>
15+
</Border>
16+
</StackLayout>
17+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Microsoft.Maui.ApplicationModel;
2+
using Microsoft.Maui.Controls.Core.UnitTests;
3+
using Microsoft.Maui.Controls.Shapes;
4+
using Microsoft.Maui.Devices;
5+
using NUnit.Framework;
6+
7+
namespace Microsoft.Maui.Controls.Xaml.UnitTests
8+
{
9+
public partial class Maui7744 : ContentPage
10+
{
11+
public Maui7744() => InitializeComponent();
12+
public Maui7744(bool useCompiledXaml)
13+
{
14+
//this stub will be replaced at compile time
15+
}
16+
17+
[TestFixture]
18+
class Test
19+
{
20+
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo());
21+
[TearDown] public void TearDown() => AppInfo.SetCurrent(null);
22+
23+
[Test]
24+
public void ConvertersAreExecutedWhileApplyingSetter([Values(false, true)] bool useCompiledXaml)
25+
{
26+
var page = new Maui7744(useCompiledXaml);
27+
Assert.That(page.border0.StrokeShape, Is.TypeOf<RoundRectangle>());
28+
Assert.That(page.border1.StrokeShape, Is.TypeOf<RoundRectangle>());
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)