Aran Mulholland
Aran Mulholland

Reputation: 23945

Programatically bringing a Datagrid column into view (horizontal scroll)

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)

Upvotes: 4

Views: 2989

Answers (2)

Aran Mulholland
Aran Mulholland

Reputation: 23945

Answer : use the datagrid method.

public void ScrollIntoView(object item, DataGridColumn column);

which takes a column. simple.

Upvotes: 8

Ganesan
Ganesan

Reputation: 109

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

Upvotes: 1

Related Questions