优化更新代码,添加界面功能并整合
This commit is contained in:
34
WPFluent/Controls/Menu/MenuLoader.xaml.cs
Normal file
34
WPFluent/Controls/Menu/MenuLoader.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace WPFluent.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Changes readonly field value of <see cref="SystemParameters.MenuDropAlignment"/> to false.
|
||||
/// </summary>
|
||||
public partial class MenuLoader : ResourceDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MenuLoader"/> class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sets menu alignment on initialization.
|
||||
/// </remarks>
|
||||
public MenuLoader() { MenuLoader.Initialize(); }
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
if(!SystemParameters.MenuDropAlignment)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FieldInfo? fieldInfo = typeof(SystemParameters).GetField(
|
||||
"_menuDropAlignment",
|
||||
BindingFlags.NonPublic | BindingFlags.Static);
|
||||
|
||||
fieldInfo?.SetValue(null, false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user