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

RadGridView -> Moving rows up and down with right clicking

1 Answer 209 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 21 Feb 2019, 06:15 AM

Hello,

I am trying to create a way to move rows up or down depending on user selection from the Context Menu.

Here are my XAML and C# code, and for some reason (still trying to figure out), the IndexOf is returning -1 =>

 

<telerik:RadGridView x:Name="gridView1" Grid.Row ="1" AutoGenerateColumns="False" Margin="0,5,0,10" FontSize="12" Deleted="OnDeletedIO" Deleting="OnDeletingIO" telerik:StyleManager.Theme="Summer" DataGridCell.GotFocus="DataGrid_CellGotFocus">
                        <telerik:RadGridView.ContextMenu>
                            <ContextMenu >
                                <MenuItem Header="MoveUp"  Click="MoveUp_click"/>
                            </ContextMenu>
                        </telerik:RadGridView.ContextMenu>
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding name}" Header="Name" IsReadOnly="False"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboGroup" DataMemberBinding="{Binding group}"  Header="Group"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboRTU" DataMemberBinding="{Binding rtu}"  Header="RTUs"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboOP" DataMemberBinding="{Binding op}"  Header="Operation"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding addr}" Header="Address"/>
                            <telerik:GridViewComboBoxColumn x:Name="ComboTypes2" DataMemberBinding="{Binding dataType}"  Header="Data Type"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding swapByte}" Header="Byte&#x0a;Swapping"
                            IsReadOnly="True">
                                
                            </telerik:GridViewDataColumn>

                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 25 Feb 2019, 09:35 AM
Hi Darren,

This thread seems to be duplicate to another one which you have posted in this forum. Let's continued there in order to avoid duplication.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Darren
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Share this question
or