Skip to main content

Microsoft Silverlight

Unanswered Question Reset the Invalid state of a textbox to the normal stateRSS Feed

(0)

ekleeman
ekleeman

Member

Member

59 points

42 Posts

Reset the Invalid state of a textbox to the normal state

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
Sledge70

Contributor

Contributor

5882 points

1,042 Posts

Re: Reset the Invalid state of a textbox to the normal state

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

 

______________________________________________________
Please mark replies as answers if they answered your question...

Flexman on Silverlight
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities