Programatically bringing a Datagrid column into view (horizontal scroll)

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 07:36:14

问题


I would like to bring a column into view programatically. I have a lot of columns and when they are off screen i would like to select a cell and bring that cell into view, i can select a cell that is off screen and when i horizontal scroll to bring the cell visible the cell is selected.

i know you can do this with the rows, i.e ScrollIntoView but how about columns?

anyone had any luck doing this? and if so how :) (of course)


回答1:


Answer : use the datagrid method.

public void ScrollIntoView(object item, DataGridColumn column);

which takes a column. simple.




回答2:


aran, suppose you want to go to 30 th column, try setting the horizontal offset of the scroll viewer.

like,

columnCount = 30;
offset = columCount * Columnwidth
scrollViewer.ScrollToHorizontalOffset(offest);

best,
Quafin



来源:https://stackoverflow.com/questions/2107362/programatically-bringing-a-datagrid-column-into-view-horizontal-scroll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!