-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array
element type ignored by Xaml compiler
#11946
Array
element type ignored by Xaml compiler
#11946
Comments
Side note, this syntax is already working at least with other kinds of collections, like IList or AvaloniaList. |
Thanks for the tip. I can confirm that those two types work, but as far as I can tell only it's them and |
To fix this bug, a change also has to be made to Avalonia. Or does it work already? |
Would be great if anyone could try using nightly build. |
It's not fixed yet, see the PR above. |
The method
AvaloniaXamlIlLanguageParseIntrinsics.GetElementType
only works forIEnumerable<T>
types. To support arrays too, these lines should be added:Unfortunately this change won't have an immediate effect due to kekekeks/XamlX/issues/89, which causes
ArrayElementType
to return the wrong value.However, once both of these bugs are fixed then Avalonia starts to support defining arrays with comma-delimited strings! e.g.
MyIntArray="1,2,3"
orMyDockArray="Top,Bottom,Top"
. This syntax is something that I wanted to write earlier today, but was unable to.To Reproduce
Add an array property to a control, then try to assign a value to it in XAML. You will receive a compiler error that looks like this:
Avalonia error AVLN: 0004: XamlX.XamlLoadException: Unable to find suitable setter or adder for property [...] of type [...] for argument netstandard:System.String, available setter parameter lists are:
Expected behavior
Arrays can be defined in XAML with comma-delimited strings, using the same parsing rules as single values of the same type.
The text was updated successfully, but these errors were encountered: