0

I use following code for adding textbox as listbox item to the listbox:

TextBox sText = new TextBox();
sText.Template = FindResource("TextBoxControlTemplate") as ControlTemplate;
sText.Text = "hi";
LBATIModelsData.Items.Add(sText);

So, how put focus on the Textbox after adding to the listbox?

tnx

Shahryar
  • 39
  • 1
  • 3
  • 10

1 Answers1

0

try

FocusManager.SetFocusedElement

FocusManager.SetFocusedElement(LBATIModelsData, sText)

See this and this SO answers

Community
  • 1
  • 1
Null Pointer
  • 9,089
  • 26
  • 73
  • 118