English 中文(简体)
1. 具有双轨碰撞坠毁的附属财产
原标题:Dependency Property with type of DoubleCollection crash app in winui 3

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

问题回答

它由以下人士确定:Shape.StrokeDashArray。 财产。

根据我的测验,你不能把<条码>DoubleCollection约束在一个以上的形状上!

您可在单一海关控制范围内,对一个<代码>DoubleCollection至几个ListView进行约束。 因此,它似乎对几个<代码>具有约束力。

您可以做的是,为每个<代码>Line建立内部<代码>。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签