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

Infinite Width when Adding/removing column programmaticaly

1 Answer 12 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 01 Aug 2011, 01:09 PM
Hi,

I am adding/removing programmaticaly a column ( named "Key") in my RadGridView (GridViewComboBoxColumn or GridViewDataColumn).

//1.0 Remove key column
            cutOffParamsGrid.Columns.Remove(cutOffParamsGrid.Columns["Key"]);
 
            //2.0 Create new Column
            if (cutOffTypeName == "X")
            {
                GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn();
                comboColumn.ItemsSource = EnumHelper.GetValuesToStringList<X>();
                comboColumn.DataMemberBinding = new Binding("X");
                comboColumn.Header = "Key";
                comboColumn.UniqueName = "Key";
                cutOffParamsGrid.Columns.Insert(0, comboColumn);
            }
            else
            {
                GridViewDataColumn column = new GridViewDataColumn();
                column.DataMemberBinding = new Binding("X");
                column.Header = "Key";
                column.UniqueName = "Key";
                cutOffParamsGrid.Columns.Insert(0, column);
            }

But if I use Width="*" my RadGridViewColumn's width is infinite...

How can I fix this ? My "Value" columns width must use all the width available.

<telerik:RadGridView.Columns>
                <!--Key column added dynamically-->
                <telerik:GridViewDataColumn Header="Key" UniqueName="Key" Width="Auto"/>
                <telerik:GridViewDataColumn Header="Value" UniqueName="Value" DataMemberBinding="{Binding Xv}" Width="*"/>
                <telerik:GridViewDataColumn Header="Delete" IsReadOnly="True" Width="50">


Regards,
S

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 04 Aug 2011, 03:42 PM
Hi Steven,

In order to test the behavior you described, I created a sample project using your code snippets. Unfortunately, I was not able to reproduce it. 

Generally, in this help article you may read about measuring with infinity when RadGridView is put inside another control or a Grid.Row with Height="Auto".

I am attaching the project. Please review it and if possible guide me on how I may get the infinite Width?

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
GridView
Asked by
Steven
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or