i 在我的首饰3中,有习惯控制,有一页称<代码>。 LineStrokeDashArray dp 定义如下:
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 :
https://i.stack.imgur.com/aspYB.png”rel=“nofollow noreferer”>。
Update: sample app:
https://github.com/WinUICommunity/files/13761523/App9.zip”rel=“nofollow noreferer”>App9.zip