From 179f2ab0e48d382d039439c64e2e8f0923561997 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sun, 17 Aug 2025 14:24:28 +1000 Subject: [PATCH] Expand sln explorer when file is selected externally --- .../Components/SolutionExplorer.razor | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/SharpIDE.Photino/Components/SolutionExplorer.razor b/src/SharpIDE.Photino/Components/SolutionExplorer.razor index a3dba48..78a5c6f 100644 --- a/src/SharpIDE.Photino/Components/SolutionExplorer.razor +++ b/src/SharpIDE.Photino/Components/SolutionExplorer.razor @@ -52,6 +52,21 @@ private MudMenu _contextMenuRef = null!; private SharpIdeProjectModel? _contextMenuProject; + protected override async Task OnParametersSetAsync() + { + if (SelectedFile is null) return; + var parent = SelectedFile.Parent; + parent.Expanded = true; + while (parent is IChildSharpIdeNode childNode) + { + if (childNode is not IExpandableSharpIdeNode expandableNode) throw new InvalidOperationException("Parent node must implement IExpandableSharpIdeNode"); + expandableNode.Expanded = true; + parent = childNode.Parent; + } + if (parent is not SharpIdeSolutionModel solutionModel) throw new InvalidOperationException("Parent node must be a SharpIdeSolutionModel"); + solutionModel.Expanded = true; + } + private async Task InvokeSelectedFileChanged(SharpIdeFile file) { SelectedFile = file;