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

Auto generated columns reordering when not visible

1 Answer 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cantenot Frederic
Top achievements
Rank 1
Cantenot Frederic asked on 29 Apr 2011, 10:50 AM
Hello,

With a RadGridView, in Q3 release, I'm using auto generated columns feature.
When user is reordering columns, they seem disturbed when some of them are not visible.

The code sample below allow you to build a grid and after hiding the first column, when you try to reorder columns, you'll get similar result as the picture attached.

<UserControl x:Class="TestGridViewColumn.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
         
        <StackPanel Orientation="Horizontal" Grid.Row="0" >
            <CheckBox Content="SampleText" IsChecked="True" Checked="CheckBox_Checked" Unchecked="CheckBox_Checked" />
            <CheckBox Content="SampleTitle" IsChecked="True" Checked="CheckBox_Checked" Unchecked="CheckBox_Checked" />
        </StackPanel>
         
        <telerik:RadGridView AutoGenerateColumns="True" x:Name="RadGridView_Sample" IsReadOnly="True" Grid.Row="1" />
    </Grid>
</UserControl>


namespace TestGridViewColumn
{
    public class SampleClass
    {
        public string SampleTitle { get; set; }
        public string SampleText { get; set; }
        public decimal SamplePrice { get; set; }
        public decimal SampleTaxes { get; set; }
        public DateTime SampleDate { get; set; }
    }
 
    public partial class MainPage : UserControl
    {
        private bool _Initialized = false;
 
        public MainPage()
        {
            InitializeComponent();
            _Initialized = true;
 
            List<SampleClass> lst = new List<SampleClass>();
            lst.Add(new SampleClass() { SampleText = "Sample 1" });
 
            RadGridView_Sample.ItemsSource = lst;
 
        }
 
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if(_Initialized)
            {
                CheckBox chk = (sender as CheckBox);
                RadGridView_Sample.Columns[chk.Content.ToString()].IsVisible = chk.IsChecked.Value;
            }
        }
    }
}


Regards

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 29 Apr 2011, 10:57 AM
Hi Cantenot Frederic,

We did have similar issues, but they have already been fixed. So, I would recommend you to try your application with our current official release Q1 2011 SP1. 
Please let me know whether you still continue to experience the same behavior.

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Cantenot Frederic
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or