Infosys Microsoft Alliance and Solutions blog

« Web Accessibility: Myths and Misconceptions | Main | Office 2007 - Word has stopped working ! »

WPF Label or TextBlock

Pre WPF days just had a Label control and hence there wasn't really a choice. Now in WPF you have Label and a new TextBlock control. I have been wondering on usually which one to use in the application when i hit upon this interesting comparison between the two by Josh. There is one additional difference mentioned in comments down below on that blog that talk about auto inversion of colors for TextBlock if it is part of say a ListItem. However to me it looked more like setting the Foreground to white, since when i tried with styling the item selection color to something else, the TextBlock still showed white color.

Honestly I am now left more confused. TextBlock is light weight and hence good from app performance perspective, but Label gives the access key functionality, something that people prefer to have in their applications. It will be really good to have this functionality extended to TextBlock.

What is it that you use in your applications and why? Comments welcome. 

TrackBack

TrackBack URL for this entry:
http://www.infosysblogs.com/microsoft-mt/mt-tb.fcgi/222

Comments

We are still in the pre-WPF days and using Label :) One of my colleagues who is using WPF in his projects is using Label. He is not aware of the performance incentive of using TextBlock!

Vijay, thanks for sharing. In pre-WPF days Label was really the only option available. In WPF one now has to pick between Label and TextBlock and it would be interesting to note how people make their choices

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)