Avalonia
Avalonia copied to clipboard
Binding to ConverterParameter
<toolBox:ToolBoxItemView IsVisible="{Binding $parent[views:EventView].EventType,
Converter={StaticResource PopurTypeVisibleConverter},
ConverterParameter={Binding $self.Type}}"/>
I expect ConverterParameter to work like CommandParameter. But instead of the value, I get a Binding instance
I expect ConverterParameter to work like CommandParameter.
Why? It works exactly the same as on WPF and probably also on WinUI. What you ask for is a feature request, not a bug.
Yes, it works like that in both WPF and WinUI. Though it would be nice to have anyway. Right now, it's possible to use MultiBinding instead.
@maxkatz6 Am I correct in understanding that it is enough to change the ConverterParameter type to DirectProperty for this?
@grokys, @kekekeks
Looking at #6865, it seems like I'm not the only one who needs this function. What do you think about this?
Ran into the same issue where the ConverterParameter needs to receive a view model instance.
I would also be happy if this function would be implemented. 👍
Yes, it works like that in both WPF and WinUI. Though it would be nice to have anyway. Right now, it's possible to use MultiBinding instead.
Well yes and no. MultiBinding doesn't allow TwoWay, nor gives you a ConvertBack method, so its scope is a bit limited. Personally, i would need exactly that, and it would be perfectly fulfilled through the binding of the ConverterParameter.
I ran into the same issue, anyone knows how to extract the actual value from the binding instance? It would be nice indeed to implement this feature
extract the actual value from the binding instance?
You can't. For now, use MultiBinding if you don't need convert back value.
That this is not possible always frustrated me in WPF. It is so unintuitive. It would be great if Avalonia could be better there.
@Mrxx99 it's planned to have this at a certain point im time. We also have PR open for it which you can test if you want to. But I can't give you a timing when it will be available as other things have higher priority