Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Row recreation on Visible change and loss of Row status(ReadOnly)

Sort Posts: Previous Next
  •  05-15-2008, 11:54 PM Post no. 12319

    Row recreation on Visible change and loss of Row status(ReadOnly)

    Hi

    1) question of performance on visible change

    I am using the DataGrid for example on a TabItem in a TabControl. Always when i switch back to the tab with the Table it recreates all (visible) rows. Is there a way to suppress the recreation of the rows and just keep the old ones? (the datasource does not change)

    2) question of row status information loss

    when I change the status of a row to ReadOnly and scroll it out of the visible area and back the row is recreated and thus it is not ReadOnly anymore. Should I create a mechanism that synchronizes the data status with the row status at all times or is there some exposed way to do it in the DataGrid.

    3) question of performance when moving rows up and down and invalidating

    when I move a row up and down in the bound IBindingList I first tryed to invalidate the changed rows on the DataGrid but it does nothing. Now i fire a ListChanged event on the IBindingList with the attribute ListChangedType.Reset which of course recreates all visible rows again. Is there a way to only change the bound data of the row and then repaint instead of recreating the row(s)

     Note: i use ListChangedType.Reset because in some DataGrid I expose a positioning column and if I move the rows up and down I actually set the new position in the Data. So from the position down the position of every Data changes.

    Great grid thanks

    Stefan

    Filed under: , ,
  •  05-16-2008, 8:49 AM Post no. 12329 in reply to 12319

    Re: Row recreation on Visible change and loss of Row status(ReadOnly)

    1. There are no way to prevent unloading of the rows at the moment. We already noted the suggestion to allow preserving data rows when the DataGridControl gets unloaded, but this feature has not yet been approved/designed/implemented. My suggestion in the mean time would be to create your own Tab switching control that does not unload the content of the tabs when switching tabs.

    2. Because of UI Virtualization, rows are recreated and cell re-assigned to new data items constantly. One should avoid setting any value directly on the  Row/Cell. Instead the use of style or template triggers is suggested.

    3. If you want to move a data item in the data source and have the DataGridControl react accordingly, you need to implement change notification in your data source. ListChangedType.Reset will effectively force a recreation of each and every data row, I therefore suggest implementing the other ListChangdType messages (ItemMoved in particular).

    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
  •  05-18-2008, 11:27 PM Post no. 12356 in reply to 12329

    Re: Row recreation on Visible change and loss of Row status(ReadOnly)

     Thank you for the fast answer Marc.

    1) I didn't see it from the TabControl perspective thanks for pointing that out^^

    2) I think the same about this one. It was more a comparison to WinForm DataGridView that has shared rows but keeps row data for each item in the datasource (if I remember right).

    3) ItemMoved is ok if the follow down rows are invalidated aswell. Perhaps in my case I need to use ItemMoved and for the follow down ItemChanged. Definitely better than Reset with this DataGrid.

    Greetings

    Stefan

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