"Clickable" textblock?

pearcewg picture pearcewg · Nov 29, 2010 · Viewed 19.1k times · Source

I have a WP7 app where I would like to have a "clickable" TextBlock area, that when a user clicks on the TextBlock, it puts it into edit mode (a different control). This would add another explicit step for a user before editing text.

There is no click event for the TextBlock (which doesn't surprise me).

Is there any way to do this? Wrapped in another control, or something similar?

Answer

alansiqueira27 picture alansiqueira27 · Nov 29, 2010

Yes, there is a click event. Its called MouseLeftButtonDown

textBlock1.MouseLeftButtonDown +=new MouseButtonEventHandler(textBlock1_MouseLeftButtonDown);

private void textBlock1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{

}