i have a custom control in my winui 3 app and i have a dp called LineStrokeDashArray
dp defined like this:
testControl : Control
{
public DoubleCollection LineStrokeDashArray
{
get { return (DoubleCollection)GetValue(LineStrokeDashArrayProperty); }
set { SetValue(LineStrokeDashArrayProperty, value); }
}
public static readonly DependencyProperty LineStrokeDashArrayProperty =
DependencyProperty.Register("LineStrokeDashArray", typeof(DoubleCollection), typeof(testControl), new PropertyMetadata(default(DoubleCollection)));
}
and in my style and ControlTemplate:
<Line
VerticalAlignment="Center"
Stretch="Fill"
Stroke="{TemplateBinding LineStroke}"
StrokeDashArray="{TemplateBinding LineStrokeDashArray}"
StrokeEndLineCap="Square"
StrokeStartLineCap="Square"
StrokeThickness="{TemplateBinding LineStrokeThickness}"
X2="1" />
now when i want to use my control like this:
<local:testControl LineStrokeDashArray="2,2" />
my app crash, i also tried
new PropertyMetadata(new DoubleCollection()));
and my app still crashing. i dont know why this is happening, and since this is a winui 3 app, there is no more info for crash and i get this :
Update: sample app:
It is determined by the personality of Shape.StrokeDashArray Property.
According to my test, you cannot bind a DoubleCollection
to more than one shape!