英文:
Cancelling SplitView Close Event without Stopping Mouse Events
问题
我正在开发一个WinUI 3应用程序,我想让我的SplitView.Pane
永久保持打开状态。我使用了这个 StackOverflow答案来尝试解决这个问题,但是使用以下代码会停止SplitView
的子元素上的所有鼠标事件:
private void SplitView_PaneClosing(SplitView sender, SplitViewPaneClosingEventArgs args)
{
args.Cancel = true;
}
我的问题是,是否有一种不同的方法可以防止SplitView
关闭其面板,或者是否有另一种组件可以让我看起来与SplitView
相同,但无法关闭面板。
英文:
I'm working on a WinUI 3 app, and I'd like to have my SplitView.Pane
permanently open. I used this StackOverflow answer to try and solve the problem, however doing
private void SplitView_PaneClosing(SplitView sender, SplitViewPaneClosingEventArgs args)
{
args.Cancel = true;
}
will stop all mouse events to children elements of the SplitView
.
My question is whether there is a different way to keep the SplitView
from closing its pane, or maybe another component to give me the same look as the SplitView
without the pane being able to be closed.
答案1
得分: 2
<SplitView
DisplayMode="Inline"
IsPaneOpen="True">
<SplitView.Pane>
<TextBlock Text="Pane" />
</SplitView.Pane>
<TextBlock Text="Content" />
</SplitView>
英文:
Besides setting IsPaneOpen
to True
, try setting DisplayMode
to Inline
.
<SplitView
DisplayMode="Inline"
IsPaneOpen="True">
<SplitView.Pane>
<TextBlock Text="Pane" />
</SplitView.Pane>
<TextBlock Text="Content" />
</SplitView>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论