WPF - Temporarily stop data binding (data binding)

I have a text field that is attached (oneway) to a datatable that updates a couple of times per second. Thus, the value of the text field constantly reflects changes in the datatable. When I enter a text box to manually set the value, the binding causes the value to be constantly overwritten. How to stop it? When I entered the value (the lost focus of the text field), I want the text field to return to display the associated value, and not the value that I just entered manually.

+3
source share
2 answers

I had the same problem and solved it

  • BindingNavigator null

    bdNavProduct.BindingSource = null;

  • , datagridview, DataBinding

         txtProductID.DataBindings.Clear();
         txtProductName.DataBindings.Clear();
         txtQuantity.DataBindings.Clear();
         txtUnitPrice.DataBindings.Clear();
         dgvProduct.DataBindings.Clear();
    

+2

, .

, , ? Uneditable Textblock, .

, , Textbox, , , .

+1

Source: https://habr.com/ru/post/1730641/


All Articles