-
-
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
ItemsPanelTemplate TemplateBinding causes AVLN2000 compile error after upgrading from 11.2.0 to 11.2.1 #17553
Comments
I had the same problem 😂. |
Is ItemsPanelTemplate considered part of ControlTemplate? |
This one puzzled me for a moment, as this wasn't supposed to be a supported scenario. But if it worked in previous versions, that would indeed be a source breaking change that needs fixing... It turns out this never really worked! This is easily verifiable. Adjust the bound <Style Selector="local|StackCard">
<Setter Property="Background" Value="OrangeRed" />
<Setter Property="Spacing" Value="32" />
<Setter Property="Template">
<ControlTemplate>
<ScrollViewer>
<ItemsControl Background="DodgerBlue">
<ItemsControl.ItemsSource>
<generic:List x:TypeArguments="x:String">
<x:String>Abc</x:String>
<x:String>Def</x:String>
</generic:List>
</ItemsControl.ItemsSource>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel
Height="100"
Background="{TemplateBinding Background}"
Spacing="{TemplateBinding Spacing}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
</ControlTemplate>
</Setter>
</Style> I've tested 11.0.13, 11.1.4 and 11.2.0 and they all exhibit the same behavior here: the Plus, in 11.2.1 you can now use a
Here's a summary table showing the resolved
(Edit: removed the resource row, as it doesn't work as expected.) |
Thanks for the detailed investigation @MrJul, can confirm in our project it seems the For the binding I intended to do, should it be using something like |
Thanks for confirming! I'm closing this issue.
Indeed, that would be the correct way to proceed. |
I keep getting this error over and over again.
I'm learning web development, and I daily drive Linux, so I can't really use WPF etc. so I went the Avalonia route, because I thought It was mature enough to use based on the applications and info I could find. There's been a lot of frustration this past week, because I've only used Avalonia this week, while the others are learning about WPF. I have no idea how to resolve this and ChatGPT only gave me answers that aligned with what I had already done. Also there's been a bit of a problem with other stuff, ChatGPT keeps telling me that ListView & PasswordBox should exist and work, but It doesn't really seem like that since their responding classes doesn't show up as an alternative, so I have to make due with what shows up. This is the code that I have problem with, it should work, but it doesn't, so I must have done something wrong which is more likely since I'm new to this and is learning, OR Avalonia is borked. "/
This snippet is the problem child here. . .
|
Describe the bug
A TemplateBinding in a StackPanel within a ItemsPanelTemplate was working in 11.1.x and 11.2.0, after 11.2.1 update it causes this error:
Seems TemplateBinding is resolving to the ItemsControl instead of the actual template control with the Spacing property, is this an intended behavior change?
Possibly related to #17483
To Reproduce
Expected behavior
No response
Avalonia version
11.2.1
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: