Retrieve all Data Bindings from WPF Window

前端 未结 2 779
慢半拍i
慢半拍i 2020-12-12 01:26

I have a WPF form which has many controls on it. Many (but not all) of these controls are databound to an underlying object. At certain times, such as when the Save button

2条回答
  •  星月不相逢
    2020-12-12 02:08

    There is a better solution in .NET 4.5 and above:

    foreach (BindingExpressionBase be in BindingOperations.GetSourceUpdatingBindings(element))
    {
        be.UpdateSource();
    }
    

提交回复
热议问题