I have the following XAML:
<Window x:Class="String_Format.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="MainWindow" Height="150" Width="250">
<StackPanel Margin="10">
<TextBlock Name="TextBlock" Text="{Binding Source={x:Static s:DateTime.Now}, StringFormat=Date: {0:dddd, MMMM dd}}"/>
</StackPanel>
</Window>
In the XAML designer in Visual Studio 2015 as well as in the running application, this displays as: "Date: Thursday, January 28". As I am on a German Windows 7 with regional settings set to "German (Germany)", I had actually expected: "Date: Donnerstag, Januar 28".
So I went and added the namespace
xmlns:c="clr-namespace:System.Globalization;assembly=mscorlib"
and altered my TextBlock to:
<TextBlock Name="TextBlock" Text="{Binding Source={x:Static s:DateTime.Now}, ConverterCulture={x:Static c:CultureInfo.CurrentCulture}, StringFormat=Date: {0:dddd, MMMM dd}}"/>
This indeed results in my desired behavior at runtime, but in the XAML designer, it says "Invalid Markup", and there's no preview of my window displayed an more.
This has been asked before, but I wanted to do it inside XAML, without using code behind, if possible.
So what's wrong with my XAML? I'd like to understand.