Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate data binding before method ends
    primarykey
    data
    text
    <p>I really liked reading solutions at stackoverflow.com in the past. Now I've got a question I couldn't find an asnwer for. Here we go :-)</p> <p>I use two 3rd party components in my code. One is the busy indicator from the Extenden WPF Toolkit. See the XAML.</p> <pre><code>&lt;tool:BusyIndicator IsBusy="{Binding RequirementsModel.Working}" BusyContent="Fetching Data..." &gt; &lt;local:RequirementsTree Model="{Binding RequirementsModel}" x:Name="Sample" /&gt; &lt;/tool:BusyIndicator&gt; </code></pre> <p>IsBusy is binded to RequirementsModel.Working. RequirementsModel is part of my view model which comes with the DataContext. Let's have a look at an extract of my RequirementsModel.</p> <pre><code> class RequirementsModel : ITreeModel, INotifyPropertyChanged { private bool _working; public bool Working { get { return _working; } set { _working = value; RaisePropertyChanged("Working"); } } public bool HasChildren(object parent) { Working = true; /* Data access shall happen here Entered dummy code */ System.Threading.Thread.Sleep(2000); bool value = true; Working = false; return value; } public event PropertyChangedEventHandler PropertyChanged; public void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } } </code></pre> <p>As you can see, the property "Working" gets changed and the binding in the WPF view should work out. But it happens nothing. I guess this situation occures because the update of the view happens after the method has been ended. But Working is false by then again. I also know that I could set the property in a calling method and make HasChildren() be called asynchronous, but that would include changig the other 3rd party component. Do you have any idea how to make that work?</p> <p>Thanks Jan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload