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

Invisible columns are visible....

1 Answer 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sanket Singhvi
Top achievements
Rank 1
Sanket Singhvi asked on 12 Apr 2011, 09:05 PM
Hi,

I have found a serious bug in the new release. I have attached the example project as well. 

Run the project using the set of DLLs which are there in the bin/debug folder. 

There are Three columns in the GridView. Second column is set to invisible (isVisible = false). But when you run the project you can see second column is visible. Although the Header is empty. you can't resize the column. it just sit there.

One thing I figured it out that if I don;t set the width property of other columns it looks fine. But as you play with the Width or MinWidth property of column it will display the hidden column.

It was not happening before. These Telerik dll we got from the RadControls_for_WPF35_2011_1_0315_Dev.msi Setup.

The same issue is happening in silverlight as well. Let me know if you have any trouble in reproducing it.

I don't find any way to attach the sample project. so just pasting the code here. Name the project as "HiddenColumns". There are two files MainWindow.xaml and MainWindow.xaml.cs

Regards
Sanket Singhvi

MainWindow.xaml
----------------------
<Window x:Class="HiddenColumns.MainWindow"
        xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Controls:RadGridView x:Name="_mainGrid" SelectionUnit="FullRow" SelectionMode="Single">
        </Controls:RadGridView>
    </Grid>
</Window>
 
MainWindow.xaml.cs
-------------------------
 
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
 
namespace HiddenColumns
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private DataTable _dataTable;
        private GridViewDataColumn _colA;
        private GridViewDataColumn _colB;
        private GridViewDataColumn _colC;
 
        public MainWindow()
        {
            InitializeComponent();
            Init();
        }
 
        private void Init()
        {
            CreateGrid();
            GetDataTable();
            FillGrid();
        }
 
        private void FillGrid()
        {
            DataRow row = _dataTable.NewRow();
            row["_colA"] = "1";
            row["_colB"] = "This is a Dummy Record";
            row["_colC"] = "This is Third Column";
            _dataTable.Rows.Add(row);
 
            _mainGrid.ItemsSource = _dataTable;
        }
 
        private void CreateGrid()
        {
            _mainGrid.AutoGenerateColumns = false;
            if (_colA == null)
            {
                _colA = new GridViewDataColumn();
            }
 
            //
            //  _ColA
            //
            _colA.UniqueName = "_colA";
            _colA.Header = "Column A";
            _colA.IsGroupable = false;
            _colA.IsFilterable = false;
            _colA.IsReadOnly = true;
            _colA.IsVisible = true;
            _colA.Width = 100;
 
            if (_colB == null)
            {
                _colB = new GridViewDataColumn();
            }
 
            //
            //  _colB
            //
            _colB.UniqueName = "_colB";
            _colB.Header = "Column B";
            _colB.IsGroupable = false;
            _colB.IsFilterable = false;
            _colB.IsReadOnly = true;
            _colB.IsVisible = false;
             
            //
            //  _colC
            //
            if (_colC == null)
            {
                _colC = new GridViewDataColumn();
            }
            _colC.UniqueName = "_colC";
            _colC.Header = "Column C";
            _colC.IsGroupable = false;
            _colC.IsFilterable = false;
            _colC.IsResizable = false;
            _colC.Width = 150;
 
            _mainGrid.Columns.Clear();
            _mainGrid.Columns.Add(_colA);
            _mainGrid.Columns.Add(_colB);
            _mainGrid.Columns.Add(_colC);
 
            //_mainGrid.Width = 480;
            _mainGrid.ShowGroupPanel = false;
        }
 
        private void GetDataTable()
        {
            if (_dataTable == null)
            {
                _dataTable = new DataTable();
            }
            _dataTable.Columns.Add("_colA");
            _dataTable.Columns.Add("_colB");
            _dataTable.Columns.Add("_colC");
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Apr 2011, 07:14 AM
Hi,

The problem is already fixed in our latest internal build and before the end of this week we will release official Q1 2011 SP1.

Best wishes,
Vlad
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
Sanket Singhvi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or