开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜