Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display Count from textbox - MVVM
Message
De
22/10/2011 08:54:31
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Display Count from textbox - MVVM
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01527088
Message ID:
01527088
Vues:
102
I have a WPF application with MVVM and need to show a label over a textbox that indicates the remaining number of characters allowed to be in the textbox. I can't seem to wrap my head around the best way to do this.

The user is able to type up to 183 characters in the text box. I would like to show a label above it that indicates (Max Characters: 183). But as they type, I want to show (Remaining Characters: 182). Once they reach 0 it should be 0 but then show in red.

The text box is bound to a property in the View Model which I could get a count on easy enough, however how would I raise the event indicating the text property has changed? WPF does not access the property setters directly.

Timothy
Timothy Bryan
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform