I answer to a previous question, the following solution was provided (and helped greatly):
<sdk:Label>
<TextBlock Text="This is underlined" TextDecorations="Underline" />
</sdk:Label>
It seems that the following XAML would achieve the same result:
<TextBlock Text="This is underlined" TextDecorations="Underline" />
So my question is: Why would one want to put a TextBlock in a Label? What advantages does that give you? What is the criteria to do it one way or another?
As you probably guessed, there is probably something fundamental about the XAML objects that I’m not understanding yet.
In most general cases, it does not give you any advantages.
In fact, in the case you have defined, the TextBlock should not be wrapped with a Label.
Label is a ContentControl. It renders any type of content given to it using the ContentTemplate. By default, when you try to render a string, it internally uses TextBlock to render it.
So, following are identical:
In this case, using a Label only gives you an advantage if you have a custom ContentTemplate defined using an implicit style inside App.xaml so that it is applied to all the Labels in the application.
Otherwise, it’s the same and only a TextBlock should be used if the only requirement is to display some underlined text.