Custom Converter stop working at nightly versions
See original GitHub issueDescription:
I have a IValueConverter
which works just fine at Avalonia 11 preview.4 but it stops working somewhere in between 11.0.999-cibuild0026023-beta
and 11.0.999-cibuild0026698-beta
and still not working at latest nightly. It feels like a regression or some non-obvious change in styling / binding / APIs, requiring me to somehow update my code in a non-obvious way.
Steps to reproduce:
I can’t share the converter code on public, thus can provide only abstracted steps to follow:
- Add
MyConverter : IValueConverter
to the project. - Declare it as
StaticResource
inApplication.Resources
, i.e.<ns:MyConverter x:Key="MyConverter"/>
. - Add this converter to
Opacity
property of anyVisual
with classmyClass
, i.e.:
<Style Selector=":is(Visual).myClass">
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:1"/>
</Transitions>
</Setter>
<Setter Property="Opacity">
<Binding Converter="{StaticResource MyConverter}"/>
</Setter>
</Style>
- Put this Style Selector into the
Application.Styles
(I did this using<StyleInclude Source="/Styles/MyStyles.axaml" />
). - Add class
myClass
to anyVisual
and change itsOpacity
usingBinding
:<Image Classes="spinner myClass" Opacity="{Binding IsBusy}"/>
MyConverter
should convert bool
to double
in order to test the behavior, and bool IsBusy
should be set to true
first and change to false
after a few seconds.
See it doesn’t change Opacity
in nightly builds since 11.0.999-cibuild0026698-beta
and at least till the 11.0.999-cibuild0028309-beta
(currently latest available), while it working fine and change the Opacity
in 11 preview.4
and 11.0.999-cibuild0026023-beta
nightly.
Expected behavior
Opacity
changes using declared Transition
according to the converted IsBusy -> 1
value.
Environment:
- OS: Windows 11 22H2
Issue Analytics
- State:
- Created 8 months ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Can you also help to review my geometry converter PR? I think there is implicit conversion in compile phase but I’m not sure.
For the context, I found that bool to double implicit conversion is done here: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Utilities/TypeUtilities.cs#L202