繁体   English   中英

如何在WPF控件/控件集中获得与具有链接到其他页面内容的HTML相同的行为?

[英]How can I get the same behavior in a WPF control/set of controls as that of HTML with links to other page content?

在HTML中,我可以添加链接<a href="#tagID"> ,该链接将跳转到具有该ID的另一个标签(即<div id="tagID"> )。

在我的WPF程序中,我有一个GroupBox列表,当前位于ScrollViewer 我希望能够以某种方式单击链接或按钮,或者具有一种将适当的GroupBox滚动到顶部的方式,与链接到HTML页面上的ID的方式几乎相同。

如何使用WPF获得此功能? 有控件可以做到这一点吗?

使用FrameworkElement.BringIntoView()方法:

<Button Content="Go To GroupBox 10"
        Click="Button_Click"/>

背后的代码:

private void Button_Click(object sender, RoutedEventArgs e)
{
    GroupBox10.BringIntoView();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM