Tuesday, August 3, 2010

Dynamically change the style of a control in wpf

private void txtUserName_TextChanged(object sender, TextChangedEventArgs e)
{
this.lblMessage.Content = string.Empty;
this.txtUserName.Style = (Style)FindResource("JBIRoundedTextBox");
this.txtUserName.Focus();
}

private void txtPassword_PasswordChanged(object sender, RoutedEventArgs e)
{
this.lblMessage.Content = string.Empty;
this.txtPassword.Style = (Style)FindResource("JBIRoundedPasswordBox");
this.txtPassword.Focus();
}

No comments:

Post a Comment