Skip to content

Commit

Permalink
Merge pull request #1653 from vchelaru/vicdotexe/1640-loosing-focus
Browse files Browse the repository at this point in the history
1640 - focus disjoint on treenode movement
  • Loading branch information
vchelaru authored Nov 23, 2024
2 parents 4c1c113 + 9f747ad commit dc4f784
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions FRBDK/Glue/Glue/FormHelpers/RightClickHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2204,8 +2204,11 @@ private static void PostMoveActivity(object objectMoved, int oldIndex, int newIn
}

PluginManager.ReactToObjectReordered(objectMoved, oldIndex, newIndex);
ObjectMoved?.Invoke(objectMoved);
}

public static event Action<object> ObjectMoved;

public static void SetExternallyBuiltFileIfHigherThanCurrent(string directoryOfFile, bool performSave)
{
if (directoryOfFile == null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FlatRedBall.Glue.Events;
using FlatRedBall.Glue.Events;
using FlatRedBall.Glue.FormHelpers;
using FlatRedBall.Glue.Managers;
using FlatRedBall.Glue.Navigation;
Expand All @@ -15,6 +15,7 @@
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using PropertyTools.Wpf;

namespace OfficialPlugins.TreeViewPlugin.Views;

Expand Down Expand Up @@ -46,6 +47,15 @@ public enum LeftOrRight
public MainTreeViewControl()
{
InitializeComponent();
RightClickHelper.ObjectMoved += movedObject =>
{
if (GlueState.Self.Find.TreeNodeByTag(movedObject) is { } treeNode &&
MainTreeView.ItemContainerGenerator.ContainerFromItem(treeNode) is TreeListBoxItem treeItem)
{
Dispatcher.BeginInvoke(treeItem.Focus);
}
};

}

#region Hotkey
Expand Down

0 comments on commit dc4f784

Please sign in to comment.