Search code examples
buttonwindows-8onclickwinrt-xamltextblock

Should I use Button or TextBlock?


I have two options. I need 48 of a certain type control; it needs to respond to clicks and taps (for touch devices).

I could use Buttons, using the TextButtonStyle, and the Click event. Or I could use TextBlock, with the Tapped event.

I reckon buttons may be more "expensive" to create. OTOH, although I believe "Tapped" is also called when the user clicks the component, this makes me a little nervous due to its nomenclature, I guess.

Another difference is that a button takes up only the width necessary, whereas a TextBlock takes everything; and I want the underlying Grid to be tappable, so the TextBlock is kind of a problem that way. Is there a property that will make it more modest like the button?


Solution

  • There is design guidance for Windows Store apps on when and how to use buttons at http://msdn.microsoft.com/en-US/library/windows/apps/hh465470. Based on your description and this guidance, it sounds like buttons are the way to go. Responding to click events is what they were made for, and TextBlocks add the extra issues that you describe.