Skip to content

Commit

Permalink
Make the right arrow in "Scripts" menu compatible with the dark mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladiStep committed Apr 18, 2023
1 parent 0f88a60 commit 4727dcc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions UndertaleModTool/Controls/System/MenuItemDark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Windows.Shapes;

namespace UndertaleModTool
{
Expand All @@ -26,5 +27,14 @@ private void MenuItemDark_Loaded(object sender, RoutedEventArgs e)

content.SetResourceReference(BackgroundProperty, SystemColors.MenuBrushKey);
}

/// <inheritdoc/>
public override void OnApplyTemplate()
{
var rightArrow = MainWindow.FindVisualChild<Path>(this, "RightArrow");
rightArrow?.SetResourceReference(Path.FillProperty, SystemColors.MenuTextBrushKey);

base.OnApplyTemplate();
}
}
}
2 changes: 1 addition & 1 deletion UndertaleModTool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2152,7 +2152,7 @@ private void MenuItem_RunScript_SubmenuOpened(object sender, RoutedEventArgs e,

var subDirName = subDirectory.Name;
// In addition to the _ comment from above, we also need to add at least one item, so that WPF uses this as a submenuitem
MenuItem subItem = new MenuItem {Header = subDirName.Replace("_", "__"), Items = {new MenuItem {Header = "(loading...)", IsEnabled = false}}};
MenuItemDark subItem = new() {Header = subDirName.Replace("_", "__"), Items = {new MenuItem {Header = "(loading...)", IsEnabled = false}}};
subItem.SubmenuOpened += (o, args) => MenuItem_RunScript_SubmenuOpened(o, args, subDirectory.FullName);
item.Items.Add(subItem);
}
Expand Down

0 comments on commit 4727dcc

Please sign in to comment.