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

Canuserfreezecolumns and columns visibility

5 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 28 Aug 2012, 08:36 AM
Hi, 

When I set canuserfreezecolumns property to true, and want to hide one or many columns programmatically by doing this : myGrid.Columns["1"].IsVisible = false; it takes a long time to be rendered. Can some one tell me why please?

thanks for help.

5 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 29 Aug 2012, 06:50 AM
Can someone help me please !
0
Yoan
Telerik team
answered on 29 Aug 2012, 01:21 PM
Hello Radouan,

 Unfortunately I was not be able to reproduce the problem you described. For your convenience I have prepared a sample project demonstrating test. Please, find it attached and let me know in case you need further assistance. 

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mike
Top achievements
Rank 1
answered on 29 Aug 2012, 02:55 PM
Hi, 
Thanks for reply, but...
I thought I posted in the wrong place. Your sample is a WPF project.
I forgot one thing, I enabled EnableColumnVirtualization & EnableRowVirtualization and it works fine. But I need to disable these properties to resolve an other performance problem. When EnableColumnVirtualization  &  EnableRowVirtualization  are enabled, then Expander is not fluid. I think that it's due to GridView resizing.

this is my code:
<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <telerik:RadSlider>
            <!--My options UI -->
        </telerik:RadSlider>
        <telerik:RadGridView>
            <!--my columns-->
        </telerik:RadGridView>
    </Grid>


How can I do ?

Thanks for help.

0
Mike
Top achievements
Rank 1
answered on 30 Aug 2012, 09:16 AM
Hello, 

I can't upload a projet as attachement. I post a sample code here.

Mainpage.xaml
<UserControl
    x:Class="SilverlightApplication1.MainPage"
    Width="640" Height="480" KeyDown="UserControl_KeyDown">
 
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
         
         
        <telerik:RadExpander>
            <Canvas Height="200"/>
        </telerik:RadExpander>
        <telerik:RadGridView EnableColumnVirtualization="True" EnableRowVirtualization="True" x:Name="gridView" Grid.Row="1"/>
         
         
    </Grid>
</UserControl>


MainPage.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
 
namespace SilverlightApplication1
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            // Required to initialize variables
            InitializeComponent();
             
            Init();
        }
 
        public void Init(){
         
            var itemSource  = new List<entity>();
             
            for(int i=0; i<200; i++)
                itemSource.Add(new entity{
                    value1 = i.ToString(),
                    value2 = i.ToString(),
                    value3 = i.ToString(),
                    value4 = i.ToString(),
                    value5 = i.ToString(),
                    value6 = i.ToString(),
                    value7 = i.ToString(),
                    value8 = i.ToString(),
                    value9 = i.ToString(),
                    value10 = i.ToString(),
                    value11= i.ToString(),
                    value12= i.ToString(),
                    value13 = i.ToString(),
                    value14= i.ToString(),
                    value15 = i.ToString(),
                });
             
            gridView.ItemsSource = itemSource;
        }
         
        private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            for(int i=0;i<9; i++)
                gridView.Columns[i].IsVisible = !gridView.Columns[i].IsVisible;
        }
         
        public class entity{
         
        public string value1 {get;set;}
        public string value2 {get;set;}
        public string value3 {get;set;}
        public string value4 {get;set;}
        public string value5 {get;set;}
        public string value6 {get;set;}
        public string value7 {get;set;}
        public string value8 {get;set;}
        public string value9 {get;set;}
        public string value10 {get;set;}
        public string value11 {get;set;}
        public string value12 {get;set;}
        public string value13 {get;set;}
        public string value14 {get;set;}
        public string value15 {get;set;}
        }
    }
}


this code reproduce the issue. I believe that I must enable Virtualization to importe performance, but when it is enabled, then expander is not fluid.


0
Yoan
Telerik team
answered on 30 Aug 2012, 03:02 PM
Hello Radouan,

 You can open a support ticket in order to attach a sample project. However, I could not reproduce any problem with the code you provide as you can see in this video. It is expected for RadGridView or RadExpander to be slow when you do not use virtualization. For more information about UI virtualization 
please check this article.

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or