This question is locked. New answers and comments are not allowed.
After upgrading from the Q2 to Q3 releases, the ReorderColumns function doesn't seem to work as it used to.
In the sample code below, I have a class that the grid is bound to. The grid has four columns. I'm hiding the first two columns and trying to reorder the columns so that the 4th column displays first and the 3rd column displays second.
I have validated that this code works correctly with the Q2 release.
In the sample code below, I have a class that the grid is bound to. The grid has four columns. I'm hiding the first two columns and trying to reorder the columns so that the 4th column displays first and the 3rd column displays second.
I have validated that this code works correctly with the Q2 release.
| <UserControl xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" x:Class="GridReorderIssue.MainPage" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> |
| <Grid x:Name="LayoutRoot"> |
| <telerikGridView:RadGridView x:Name="gdMain" AutoGenerateColumns="False"> |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn Header="One" UniqueName="One" IsVisible="False" /> |
| <telerikGridView:GridViewDataColumn Header="Two" UniqueName="Two" IsVisible="False" /> |
| <telerikGridView:GridViewDataColumn Header="Should be 2nd" UniqueName="Three" /> |
| <telerikGridView:GridViewDataColumn Header="Should be 1st" UniqueName="Four" /> |
| </telerikGridView:RadGridView.Columns> |
| </telerikGridView:RadGridView> |
| </Grid> |
| </UserControl> |
| namespace GridReorderIssue |
| { |
| public partial class MainPage : UserControl |
| { |
| public MainPage() |
| { |
| InitializeComponent(); |
| List<SampleClass> Data = new List<SampleClass>(); |
| Data.Add(new SampleClass() { One = 1, Two = "Two-1", Three = true, Four="Four-1" }); |
| Data.Add(new SampleClass() { One = 2, Two = "Two-2", Three = false, Four="Four-2" }); |
| gdMain.ReorderColumns(3, 0); |
| gdMain.ReorderColumns(2, 1); |
| gdMain.ItemsSource = Data; |
| } |
| } |
| public class SampleClass |
| { |
| public int One { get; set; } |
| public string Two { get; set; } |
| public bool Three { get; set; } |
| public string Four { get; set; } |
| } |
| } |