[英]How can I scroll the grid programatically in WPF?
I am generating grid from c#
code in WPF
application. 我正在
WPF
应用程序中从c#
代码生成网格。 My grid
is dynamically generated using the code and it contains many rows. 我的
grid
是使用代码动态生成的,并且包含许多行。 I want to scroll the grid to some specific element
in the grid so user can see specific element as a first record in grid. 我想
scroll the grid to some specific element
,以便用户可以将特定元素视为网格中的第一条记录。 Can you please help us that how can we scroll the grid programatically in WPF? 您能帮助我们如何在WPF中以编程方式滚动网格吗?
Will DataGrid.ScrollIntoView work for you? DataGrid.ScrollIntoView是否适合您? The first parameter(item) is the element you want to show.
第一个参数(项目)是要显示的元素。
//
// Summary:
// Scrolls the System.Windows.Controls.DataGrid vertically and horizontally
// to display a cell for the specified data item and column.
//
// Parameters:
// item:
// The data item to bring into view.
//
// column:
// The column to bring into view.
public void ScrollIntoView(object item, DataGridColumn column);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.