Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1640 - focus disjoint on treenode movement #1653

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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