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(); 
        this.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
Not finding the help you need? Improve this article