Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing a textbox
Message
 
À
29/12/2014 15:26:15
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01605402
Message ID:
01613052
Vues:
33
Many thanks Timothy.

I understand the concepts (I think), have not yet had the opportunity to implement them.


>Marc,
>
>If you are binding your textbox to a property in the ViewModel, you do need to implement INotifyPropertyChanged. In addition, when the property setter is called and the value changes, you need to raise the PropertyChanged Event. WPF is based on the observer pattern which means the textbox is basically monitoring change but only when the Property Changed event is raised.
>
> public string MyTextBoxValue
> {
> get { return this._myTextBoxValue; }
> set
> {
> if (_myTextBoxValue == value)
> return;
>
> _myTextBoxValue = value;
> this.OnPropertyChanged("MyTextBoxValue");
> }
> }
> private string _myTextBoxValue;
>
>>Nothing wrong with old threads, now is there.
>>Many thanks for your kind answer. It does help to decide ... not implement
>>MVVM Light at this stage. I need somewhat more insight.
>>Happy New Year!
>>
>>
>>>Blimey - this is an old thread!
>>>
>>>TBH I've not used MVVM Light but a quick read seems to suggest that it's DespatcherHelper class might be worth looking at ?
>>>http://msdn.microsoft.com/en-us/magazine/dn630646.aspx
>>>
>>>Don't think INotifyPropertyChanged in itself will help - you still need to run the task on another thread to keep the UI responsive...
>>>
>>>HTH, Happy New Year....
>>>
>>>>Am I right in assuming that this can be done implementing MVVMLight? I understood that there is a INotifyPropertyChanged. It allows the "databindings" to be updated whenever a property changes (quoting Laurent Bugnion on Pluralsight).
>>>>
>>>>Would that be a newbie thing, or should I wait until I grow up?
>>>>
>>>>
>>>>>>>>It seems that just setting Status.Text=someValue from within a click event does not (vfp) refresh until the event is completed. How can this be done (in C#) if one wants to show the status of a multistage procedure by setting the Status.Text?
>>>>>>>
>>>>>>>If I understand correctly then you need to use a background worker to keep the UI responsive. e.g.:
>>>>>>
>>>>>>Right. Thank you very much. Was hoping for something simpler ;)
>>>>>
>>>>>Just saw your PM so you were already on the right track.
>>>>>
>>>>>In WPF everything is great but nothing is simple :-}
>>>>>
>>>>>WinForms had the Application.DoEvents which could have updated your TextBlock OK but the form would be otherwise unresponsive between calls.
>>>>>Of course the downside of BackgroundWorker is that you have to ensure that, because the form is still responsive, the user cannot perform inappropriate actions whilst the task is running.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform