This is a migrated thread and some comments may be shown as answers.

How to change two row by no reset itemsource value

5 Answers 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
rui
Top achievements
Rank 1
rui asked on 19 Sep 2016, 10:12 AM

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?

5 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 19 Sep 2016, 01:30 PM
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.
0
rui
Top achievements
Rank 1
answered on 20 Sep 2016, 01:18 AM

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

0
rui
Top achievements
Rank 1
answered on 20 Sep 2016, 01:28 AM

I find the solution  use ColumnGroupDescriptor's ResumeNotifications mothed

columnGroupDescriptor.ResumeNotifications();

thank you very much!

0
rui
Top achievements
Rank 1
answered on 28 Sep 2016, 05:33 AM

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

how to let the scrollbar keep the position

0
Dilyan Traykov
Telerik team
answered on 28 Sep 2016, 10:39 AM
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.
Tags
GridView
Asked by
rui
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
rui
Top achievements
Rank 1
Share this question
or