I'm trying to select the whole text in a dialog but I'm not able to do so.
I have a class Participant
which has a Property Firstname
. When I set the participant in my dialog I'm calling a Focus-Method. However, when the dialog is open it's only in focus but not selected.
This is my Focus-Method:
public void FocusSurname()
{
SurnameBox.SelectAll();
SurnameBox.Focus();
Keyboard.Focus(SurnameBox);
}
In the dialog I'm setting my participant as follow:
Participant Participant
{
get { return _participant; }
set
{
_participant = value;
FocusSurname();
}
}
My dialog open sourcecode is pretty much:
public void ShowDialog(object owner)
{
Owner = owner as Window;
ShowDialog();
}
Why is the text not selected? :(
Even when I call FocursSurname in my ShowDialog-Method nothing is changing.