Maya
Maya

Reputation: 1009

EditWhat is the right way to auto scroll datagrid in mvvm?

I saw a few options to auto scroll but they are not match the mvvm dp

i know i can write in the code behind event the raised when row added and then do something like: myDatagrid.ScrollIntoView(row)

but i search a better way

thanks

Edit: I did it in the code behind like Tendlon advice I did what Joseph Melettukunnel answer here: solution

Upvotes: 0

Views: 610

Answers (1)

ThomasAndersson
ThomasAndersson

Reputation: 1904

I personally think that doing this kind of task in code behind IS the right way. If you want to do it more reusable, create an attached property which contains the functionality.

Attached property is what I have done previously. I dont have access to the code right now, but can edit in later, if you should need it.

Scrolling in a datagrid is something that IMHO is a GUI-specific thing, and therefore belongs well in code behind.

Upvotes: 2

Related Questions