Reputation: 167
I am using the Extended WPF Toolkit in one of my applications, and I am using the MaskedTextBox control. When I call the Focus method on the control, it doesn't work. The Focus method works fine on TextBox controls, but it seems that the MaskedTextBox doesn't inherit from TextBox. Does anyone know how to programmatically give focus to this control?
Upvotes: 0
Views: 1200
Reputation:
You should submit the issues to the project site so it can be fixed in the toolkit and everyone can benefit.
http://wpftoolkit.codeplex.com/
Upvotes: 0
Reputation: 509
See if this works. I had to do this to the DatePicker in silverlight. Derive a control from MaskedTextBox and provide the following overrides.
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_textBox = (TextBox)base.GetTemplateChild("TextBox");
}
public new void Focus()
{
if (_textBox == null)
base.Focus();
else
_textBox.Focus();
}
private TextBox _textBox;
Upvotes: 1