MultiBinding with MultiValueConverter does not update

后端 未结 2 748
既然无缘
既然无缘 2021-01-05 01:30

it seems that I have a problem with my multibinding.

Scenario:
I have a window with two datepickers and a listview. The listliew contains some data bound element

相关标签:
2条回答
  • 2021-01-05 01:45

    After searching for hours, I find a simple and decent answer ! Since ObservableCollection doesn't raise PropertyChanged event but CollectionChanged, we just have to bind the collection's Count to fire the event when the list changes :

    <MultiBinding Converter="{Resources:ListToStringConverter}">
        <Binding Path="List.Count" />
        <Binding Path="List" />
    </MultiBinding>
    

    Original infos about this perfectly working multibinding here : https://stackoverflow.com/a/10884002/817504

    0 讨论(0)
  • 2021-01-05 02:04

    I think the following might cause this: If you bind directly to the Entries the ListView will listen to CollectionChanged events, but if such a binding is inside a MultiBinding the only thing that would cause a reevaluation could be a PropertyChanged notification, which might not exist for the Entries property in your model.

    Maybe you can subscribe to the CollectionChanged event of your collection and raise a PropertyChanged event or get the BindingExpression within your MultiBinding to call an update manually.

    0 讨论(0)
提交回复
热议问题