Crash with binding path="/" in multibinding
See original GitHub issueHello, I am having some issue that seems simple but I really cannot find any way to do it:
I have a list of MyEnum
values, I have them in a ComboBox
and have been using a converter to convert the MyEnum
items to IBitmap
s that are drawn for each ComboBox item.
Now I need to have another property of my object used as a parameter of the converter, so I looked to multiconverters, but I cannot find out how to plug in the values to the converter
The old way was:
<DataTemplate x:Key="Menu">
<Image Source="{Binding Converter={x:Static infrastructure:MyConverter.Instance}, ConverterParameter=ExampleParam, Mode=OneWay}"/>
</DataTemplate>
.....
<ComboBox Items="{Binding MyObj.SelectableItems}" ItemTemplate="{StaticResource Menu}" SelectedItem="{Binding MyObj.MyEnumValue}"/>
From browsing Google, I came up with this:
<DataTemplate x:Key="Menu">
<Image Stretch="None">
<Image.Source>
<MultiBinding Converter="{x:Static infrastructure:MyMultiConverter.Instance}" ConverterParameter="ExampleParam" Mode="OneWay">
<Binding Path="SelectedItem" ElementName="MyOtherComboBox"/>
<Binding Path="/"/> <!--This crashes-->
</MultiBinding>
</Image.Source>
</Image>
</DataTemplate>
The Path="/"
is apparently supposed to reference the current item in the iteration, like the regular bindings do, but it crashes instead. The crash is here: https://pastebin.com/raw/N29dzRaQ
Also, the converter is never called when I have Path="/"
, even when the items populate the ComboBox
I’m on 0.9.10
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
TIL there is ‘/’ in bindings.
@Kermalis something like
{Binding $parent[ComboBoxItem].DataContext}
might help.