Replies: 1 comment 4 replies
-
Selectors do not support binding expressions. This will be difficult pre-11.3.0. You need to apply a class binding to the See #16938 for how to do this on 11.3.0. You'll also want to target the Avalonia/src/Avalonia.Themes.Simple/Controls/ListBoxItem.xaml Lines 25 to 27 in 808c86f |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have created a custom style for ListBox and ListBoxItem controls.
I'm trying to condition the appearance of the pointerover in the ListBoxItem control.
My viewmodel contains a property called IsNotEditing (checking if any item is being edited) that I can access from the ListBoxItem using:
{Binding $parent[ListBox].((vm:PPViewModel)DataContext).IsNotEditing}
I also have a pointerover style to invert the colors:
<Style Selector="^:pointerover"> <Setter Property="Background" Value="{DynamicResource ForegroundColor}" /> <Setter Property="Foreground" Value="{DynamicResource BackgroundColor}" /> </Style>
I'm trying to get this pointerover to not enable when editing any item of the list.
So I'm adding a condition, and both these work as expected:
<Style Selector="^:pointerover[IsEnabled=true]">
(pointerover is enabled)<Style Selector="^:pointerover[IsEnabled=false]">
(pointerover is disabled)So now I'm trying to combine these:
<Style Selector="^:pointerover[IsEnabled="{Binding $parent[ListBox].((vm:PPViewModel)DataContext).IsNotEditing}"]">
But unfortuately, this doesn't work.
Is this even possible, am I just failing at the syntax ?
Or should this be achieved differently ?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions