Welcome to the Xceed Community | Help
Community Search  
More Search Options

trying to fill in the blanks about some common grid functionality

Sort Posts: Previous Next
  •  03-27-2012, 5:10 PM Post no. 31922

    trying to fill in the blanks about some common grid functionality


    I've worked with the wpf datagridcontrol for a little while now and I have a couple questions regarding functionality that I seem to want but not that many others on here are posting about. So it leads me to believe that my approach on some things might be a bit flawed since others aren't having the same issues in their production applications. I hope someone reading this can understand my issues and point me in the right path.

    Specifically I am referring to the ability to update the itemssource of the grid without losing scroll position/expanded group/focused row and to get/set filter criteria after a itemssource update. These are two things that I always have to write code to do in the past (capture selected stuff, update data, set selected stuff again). Without the code it makes the user experience awful, especially when you get into master/detail style grids. I have a couple of previous posts regarding how to do this in code and the responses have led me to believe that what I was asking to do was an uncommon request with the wpf datagrid. Sometimes I get a "one of our devs said you can try this" but i've not actually gotten those suggestions to work for me.

    The way I am accustomed to doing things is almost 100% entirely in code and thus far that is how I have done my wpf and silverlight stuff. It was the most natural progression from what I knew to test out what I could do in wpf.

    Back when I purchased my xceed grid license I read about MVVM design patterns but passed it over as taking too much work to implement for the simple requirements of my user interface. I then blindly trudged along working on my application and getting everything to work from minimal markup and runtime code. And then I ran into the issue again of not being able to update my grids without degrading the user experience.

    For the meantime on my grids which promote user interaction I am just not running a timer and throwing a refresh button on there. Its definitely not my ideal workaround and I want to learn how I can do this better.

    Now I am wondering if I should have worked with MVVM?

    My thought is that I can put my data update timers in my viewmodel and they will raise propertychange notifications to my view.

    What will that do to my master/detail style grid when the user is deeply scrolled into it and new data arrives? Will it silently update the values in the background or will it collapse all the groups and return the user to row 0? Similar question about the filter criteria. Ideally I would like to set it on the viewmodel and be able for the data update to come in without having to worry with trying to re-apply the filter.

    I know others update data in their grids in their production apps without this issue. Otherwise I figure I would have seen a whole lot more topics on the forum regarding it.

    Thanks for reading. 


  •  04-04-2012, 1:46 PM Post no. 31943 in reply to 31922

    Re: trying to fill in the blanks about some common grid functionality


     I was hoping someone would have replied.

     I'll keep testing things but I still need to figure out how I am supposed to change the itemssource of a datagridcontrol without losing my scroll position/selected row/expanded row information.

     My "load control" logic uses a datalayer to call for and fill a datatable object which is then used to set the datagridcontrol's itemssource property. The logic routine ends and the datatable object falls out of scope. I started thinking that I should persist this object at the class level but then I still have the same issue where I will have an old copy of the datatable and a new copy of it. I will be overwriting the old copy with the new one. I'm pretty sure that doing that will cause a itemssource change event to happen and the end result will still be that I lost my selected row, etc.

    So the real question is how do you update a underlying data source once ItemsSource has already been set?

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.