I found some items regarding this questions on SO, but they do not satisfy me. They talk about INotifyProperyChanged, but that does not help in my case.
I have a Combobox
. For the ItemsSource
, I use a MultiBinding
and a Converter
to create an ICollectionView
. The ICollectionView
gets bound to the ItemsSource
.
On the GotFocus
-event, this binding needs to be refreshed, so the converter gets fired again.
How can I do this?
Ok, a collegue helped me out.
This is the solution:
private void theComboBox_OnGotFocus(object sender, RoutedEventArgs e)
{
ComboBox theComboBox = sender as ComboBox;
if (theComboBox != null)
{
MultiBindingExpression binding = BindingOperations.GetMultiBindingExpression(theComboBox, ComboBox.ItemsSourceProperty);
if (binding != null)
{
binding.UpdateTarget();
}
}
}
If you can access your ICollectionView in your code behind, you might want to try the Refresh method...
Hope this helps..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.