What is the difference between the WPF TextBlock element and Label control? -
this question has answer here:
- difference between label , textblock 4 answers
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
Post a Comment