In HTML I can add a link <a href="#tagID">
that will jump to another tag with that id (ie <div id="tagID">
).
In my WPF program I have a list of GroupBox
es, currently inside a ScrollViewer
. I want to be able to somehow click a link or button or have a way that will scroll the appropriate GroupBox
to the top, much the same way as linking to IDs on an HTML page.
How can I get this functionality using WPF? Is there a control that will do this?
Use the FrameworkElement.BringIntoView()
method:
<Button Content="Go To GroupBox 10"
Click="Button_Click"/>
Code Behind:
private void Button_Click(object sender, RoutedEventArgs e)
{
GroupBox10.BringIntoView();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.