c# - TextBox addHandler for onFocus programmatically wp7 -


i trying add event handler textboxes in grid i'v written code below--->

// code foreach (var child in (o grid).children)  {    if (child.gettype() == typeof(textbox))    {     child.addhandler(ongotfocus, new routedeventhandler(textbox_gotfocus), true); //<---error                                }  } 

in above code want add event handler onfocus child textboxes.

but getting error here invalid arguments, can 1 fix this?

solved problem--->

txtbox.gotfocus += (sender, eargs) =>                                 {                                     if (txtbox.text == startingtext[index])                                         txtbox.text = "";                                 };  txtbox.lostfocus += (sender, eargs) =>                                 {                                     if (txtbox.text == "")                                         txtbox.text = startingtext[index];                                 }; 

Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -