Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 Reset the Invalid state of a textbox to the normal state
1 replies. Latest Post by Sledge70 on November 5, 2009.
(0)
ekleeman
Member
59 points
42 Posts
11-05-2009 4:42 AM |
Ok, I have validation working fine for a number of text boxes.
But here's the problem. I want to reset the form to the original state in code without refreshing the page.
How do we revert a textbox to the normal state after it was set to the Invalid state by throwing an exception in the setter of the data validation object?
Basically I want to be able to navigate away from the form and return to it using animations, NOT post backs or page refresh and have the textboxes reset to their normal original state.
Sledge70
Contributor
5882 points
1,042 Posts
11-05-2009 5:17 AM |
You use the VisualStateManager.GotoState method to set the visual state on a control.
Pseudo code as can't remember the exact syntax:
VisualStateManager.GotoState(myControl, "Valid", true);
http://msdn.microsoft.com/en-us/library/system.windows.visualstatemanager.gotostate(VS.95).aspx