我有一个带有多个扩展器的 WPF 应用程序
<ScrollViewer>
<StackPanel>
<Expander Header="OuterExpander1" Expanded="ExpanderExpanded">
<StackPanel>
<Expander Header="InnerExpander1" Expanded="ExpanderExpanded"/>
<Expander Header="InnerExpander2" Expanded="ExpanderExpanded"/>
</StackPanel>
</Expander>
<Expander Header="OuterExpander2" Expanded="ExpanderExpanded">
<StackPanel>
<Expander Header="InnerExpander3" Expanded="ExpanderExpanded"/>
<Expander Header="InnerExpander4" Expanded="ExpanderExpanded"/>
</StackPanel>
</Expander>
</StackPanel>
</ScrollViewer>
private void ExpanderExpanded(object sender, System.Windows.RoutedEventArgs e)
{
(sender as Expander).BringIntoView(new Rect(0, 0, 0, 1000));
}
但是 BringIntoView 方法不适用于内部扩展器,我该如何解决这个问题?