diff --git a/Src/Common/Controls/DetailControls/Slice.cs b/Src/Common/Controls/DetailControls/Slice.cs index c933245bfb..43e4d4abe3 100644 --- a/Src/Common/Controls/DetailControls/Slice.cs +++ b/Src/Common/Controls/DetailControls/Slice.cs @@ -2241,19 +2241,30 @@ public Slice ExpandSubItem(int hvo) for (int islice = IndexInContainer + 1; islice < cslice; ++islice) { var slice = ContainingDataTree.Slices[islice]; + // Stop if we get past the children of the current object. + if (!EmbeddedSlice(slice)) + break; if (slice.Object.Hvo == hvo) { if (slice.Expansion == DataTree.TreeItemState.ktisCollapsed) slice.TreeNode.ToggleExpansion(islice); return slice; } - // Stop if we get past the children of the current object. - if (slice.Indent <= Indent) - break; } return null; } + private bool EmbeddedSlice(Slice slice) + { + foreach (object obj in Key) + { + var node = obj as XmlNode; + if (IsRefPartNode(node) && !slice.Key.Contains(node)) + return false; + } + return true; + } + /// /// Return true if the target array starts with the objects in the match array.