How to change two row by no reset itemsource value

6 posts, 0 answers
  1. rui
    rui avatar
    34 posts
    Member since:
    May 2014

    Posted 19 Sep Link to this post

    I want to change the position  of two rows 

    the itemsource is binding to Columns,   item is currentItem,

    the code :

    int index = Columns.IndexOf(item) - 1;

    Columns.Remove(item);
    Columns.Insert(index, item);

     

    now  i must reset the source  and the UI refresh

    Columns = Columns.ToList().OrderBy(t => t.column_order) as ObservableCollection<Column>

     

    Is any way  tochange the position by not refresh ui?

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 19 Sep Link to this post

    Hello Rui,

    Provided your Columns collection implements the INotifyCollectionChanged interface, any changes made to it should be reflected in RadGridView. I'm attaching a sample project in which, using the code you provided, I'm successfully able to swap the items and notify RadGridView about it.

    Could you please have a look at the attached project and let me know whether I've missed something important? If that is the case, please let me know and I will gladly assist you further.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. rui
    rui avatar
    34 posts
    Member since:
    May 2014

    Posted 19 Sep in reply to Dilyan Traykov Link to this post

    Thanks for your answer

    I'm sorry i missed an important  thing  

    i group the gridview by ColumnGroupDescriptor

    <telerik:RadGridView.GroupDescriptors>
                    <telerik:ColumnGroupDescriptor x:Name="columnGroupDescriptor" Column="{Binding Columns[\ContactTitleWithConverter\], ElementName=ESColumnGrid}"  SortDirection="Ascending"/>
    </telerik:RadGridView.GroupDescriptors>

    in your demo code i change a row cell data as same as another row  and drag the column header to group 

    and the issue is also exist

    Is there any solution for this

  5. rui
    rui avatar
    34 posts
    Member since:
    May 2014

    Posted 19 Sep in reply to Dilyan Traykov Link to this post

    I find the solution  use ColumnGroupDescriptor's ResumeNotifications mothed

    columnGroupDescriptor.ResumeNotifications();

    thank you very much!

  6. rui
    rui avatar
    34 posts
    Member since:
    May 2014

    Posted 28 Sep in reply to Dilyan Traykov Link to this post

    ResumeNotifications  can  change the two item's index  but  the GridView is scroll to top  

    how to let the scrollbar keep the position

  7. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    371 posts

    Posted 28 Sep Link to this post

    Hello,

    Could you please let me know how I need to modify the project from my previous post as well as what action steps I should take in order to reproduce the issue you've described as I am currently unable to do so?

    Thank you in advance for your cooperation on the matter.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WPF is Visual Studio 2017 Ready