How to force a WPF binding to refresh?

后端 未结 6 1225
轻奢々
轻奢々 2020-11-28 05:47

I have got a combo box with items source attached using simple binding. Is there any way to refresh this binding once combo box is loaded?

6条回答
  •  日久生厌
    2020-11-28 06:34

    MultiBinding friendly version...

    private void ComboBox_Loaded(object sender, RoutedEventArgs e)
    {
        BindingOperations.GetBindingExpressionBase((ComboBox)sender, ComboBox.ItemsSourceProperty).UpdateTarget();
    }
    

提交回复
热议问题