New to Telerik UI for WPF? Download free 30-day trial

Change Windows Handedness Settings in Code Behind

Environment

Product Version 2019.2.618
Product Progress® Telerik® UI for WPF

Description

How to change windows handedness settings in code behind.

Solution

To change the Windows Handedness settings in code, you can set the SystemParameters.MenuDropAlignment property. The method need to be called after the InitializeComponent() method.

public partial class MainWindow : Window 
{ 
    public MainWindow() 
    { 
        InitializeComponent(); 
        SetAlignment(); 
    } 
} 
 
public static void SetAlignment() 
{ 
    var ifLeft = SystemParameters.MenuDropAlignment;       
    if (ifLeft) 
    { 
        var t = typeof(SystemParameters); 
        var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static); 
        field.SetValue(null, false); 
    } 
} 
In this article