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

RadTreeListView autosize

2 Answers 149 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Fatima
Top achievements
Rank 1
Fatima asked on 23 Aug 2012, 04:47 PM
Hi,

I  want to auto size the every column by its content text automatically.because when the radtreelistview have a long content the column take all time this size even if I loaded with other data.

i tryed to put=
column.Width = GridViewLength.SizeToCells;
but it dosen't work.









2 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 28 Aug 2012, 01:41 PM
Hello Fatima,

 In order to auto size the TreeListView's columns you can set it's property ColumnWidth="Auto". Please see the code below:

<telerik:RadTreeListView ColumnWidth="Auto"   Name="radTreeListView1">
         <telerik:RadTreeListView.ChildTableDefinitions>
                 <telerik:TreeListViewTableDefinition  ItemsSource="{Binding Items}" />
         </telerik:RadTreeListView.ChildTableDefinitions>
 </telerik:RadTreeListView>

Regards,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Fatima
Top achievements
Rank 1
answered on 28 Aug 2012, 02:03 PM
Hi,

thank you for you answer .

but the solution that i found and works :

     Tlv.Columns.OfType<Telerik.Windows.Controls.GridViewColumn>().ToList().ForEach(c => c.Width = 0);
     Tlv.UpdateLayout();
     Tlv.Columns.OfType<Telerik.Windows.Controls.GridViewColumn>().ToList().ForEach(c => c.Width = new GridViewLength(1, GridViewLengthUnitType.Auto));
Tags
TreeListView
Asked by
Fatima
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Fatima
Top achievements
Rank 1
Share this question
or