What is the difference between the WPF TextBlock element and Label control? -


this question has answer here:

visually both of following snippets produce same ui. why there 2 controls..
snippet1

<textblock>name:</textblock> <textbox name="nametextbox" /> 

snippet2

<label>name:</label> <textbox name="nametextbox" /> 

(well gonna answer myself... thought useful tidbit learnt today programming wpf)

the wpf textblock inherits frameworkelement instead of deriving system.windows.control label control. means textblock more lightweight. downside of using textblock no support access/accerelator keys , there no link other controls target.

when want display text use textblock. benefit light, performant way display text.

when want associate text control textbox use label control. benefits access keys , references target control.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -