question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash with binding path="/" in multibinding

See original GitHub issue

Hello, 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 IBitmaps 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:open
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
maxkatz6commented, Jul 14, 2021

TIL there is ‘/’ in bindings.

0reactions
maxkatz6commented, Jul 14, 2021

@Kermalis something like {Binding $parent[ComboBoxItem].DataContext} might help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multibind not working in XAML/WPF
I have solved my issue by changing the binding paths I was using. I'm not sure why CurrentFrame and CurrentZoom threw an error...
Read more >
Xaml crash - ItemsControl with MultiBinding and ...
It seems occur when there is a combination of using a MultiBinding in the ItemsControl.ItemsSource and using a binding within a DataTemplate ...
Read more >
WPF DataGrid.ItemsSource in DataGrid inside another ...
VS2019 will crash when opening up the designer where <Binding/> has been implemented. Microsoft is aware of the issue and has stated at...
Read more >
MultiBinding on GridViewColumn?? in UI for Silverlight
Hi! I've a very simple problem but apparently GridViewDataColumn is not part of FrameworkElement and causes the MultiBinding to crash.
Read more >
A Simple MultiBinding Example - CodeKong - WordPress.com
The easiest way for me to demonstrate MulitBinding and its capabilities is to explain a small working sample. I have decided to create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found