CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    WPF - How to programatically PAUSE databinding

    I have a textbox that is bound (oneway) to a datatable that updates a couple of time a second. So the textbox value continually reflects changes in datatable. When I enter the textbox to manually set a value, the binding causes the value to continually be overwritten. How do I stop this? When I have entred a value (textbox lost focus) I want the textbox to return to display the bound value and not the value I have just entered manually.

    Plase note that the textbox is one of many ... each attached to a field in a DataTable. I do not want the datatable to stop sending updates to the other textboxes while I alter one textbox. Note it is OneWay binding.
    I don't believe I can prevent update on a single field in a DataTable.

    Also is it not possile to remove binding and reset it programatically .. rather than controlling the sourse that is updating?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: WPF - How to programatically PAUSE databinding

    Rather than bind to the datatable directly use a design pattern such as MV-VM and bind to a view model instead. The view model could then control the binding through a variety of means. One way is for the view model to create a copy of the item getting edited and only after the editing is completed would the view model copy the data to the actual model.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured