0
votes

As you may have guessed I'm a noob. I noticed that, when trying to make a windows phone app with VS express for windows phone, I can quickly run into problem if I:

  • Add a text block in xaml
  • Add Click="thing" in the markup for the textblock
  • Declare private void thing(object sender, MouseButtonEventArgs e) { return; } in the code behind

VS doesn't let me compile because The property 'Click' does not exist in type 'TextBlock' in the xml namespace "http://schemas.microsoft.com/winfx/2006/xaml/presentation"

I know this forum is normally not for such basic things, but I really don't understand how can I mess it up by just adding these two things. Thanks in advance

2
"Click" isn't an event that TextBlock has. What are you trying to do, perhaps we can suggest an alternative control.GrandMasterFlush
In addition to the comment above, you could have easily found that one out yourself by checking the documentation.Daniel Hilgarth

2 Answers

0
votes

Alternate is here, Use "mouseLeftButtonDown" event, this event will work same as clicked event and also available for almost all basic controls

1
votes

That's right, there's no click in TextBlock in Silverlight... http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock(v=vs.95).aspx

GotFocus may be the event you're looking for... Or you may want a different element type altogether.