Culture difference between Label and TextBlock

If you take a closer look to Label you will see that it derives from ContentControl.

Content property is displayed by a ContentPresenter where in the docs it is said the following:

If there is a TypeConverter that converts the type of Content to a UIElement, the ContentPresenter uses that TypeConverter and the resulting UIElement is displayed.

Now there is a DateTimeConverter inheriting from TypeConverter, the following snippet produces exactly the same string than a Label does:

var dateTimeConverter = new DateTimeConverter();
var convertToString = dateTimeConverter.ConvertToString(DateTime.Now);

References:

https://msdn.microsoft.com/en-us/library/system.windows.controls.contentpresenter(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/system.componentmodel.datetimeconverter(v=vs.110).aspx


They are actually quite different beasts.

Check this out for more details: https://joshsmithonwpf.wordpress.com/2007/07/04/differences-between-label-and-textblock/

Label actually isn't even a control

Tags:

C#

Wpf