开发者

What is the WPF equivalent of Silverlight's ScrollViewer.ScrollIntoView?

开发者 https://www.devze.com 2023-02-17 18:36 出处:网络
What is the WPF equivalent of Silverlight\'s ScrollViewer.ScrollIntoV开发者_StackOverflowiew?The FrameworkElement class implements a BringIntoView() method - if you are dealing with a class that inher

What is the WPF equivalent of Silverlight's ScrollViewer.ScrollIntoV开发者_StackOverflowiew?


The FrameworkElement class implements a BringIntoView() method - if you are dealing with a class that inherits from FrameworkElement you should be able to call that method. The method essentially raises the RequestBringIntoViewEvent which will bubble up the visual tree. The ScrollViewer and a bunch of other classes handle the event and then call their internal logic to bring the element into view.

Also some ItemControls such as DataGrid or ListBox provide a ScrollIntoView() method to make a child visible.

The ScrollIntoView() in turns calls the OnBringItemIntoView method in the ItemsControl class and in turn calls the FrameworkElement but also deals with a VirtualizingPanel where you might not have a FrameworkElement already created.

0

精彩评论

暂无评论...
验证码 换一张
取 消