I am trying to set the FlowDirection
of all the windows the application will generate to RightToLeft
. I tried the following
Window.FlowDirectionProperty.OverrideMetadata(
typeof(Window),
new FrameworkPropertyMetadata(CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft
? FlowDirection.RightToLeft : FlowDirection.LeftToRight));
I am doing this before I initialize any Window class.
But with this, I get TypeInitializerException
whenever I initialize a Window class.
System.TypeInitializationException: The type initializer for 'System.Windows.Window' threw an exception. ---> System.ArgumentException: PropertyMetadata is already registered for type 'Window'.
Any ideas on what I am doing wrong or how I could change my code to get this to work?