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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -