RadTreeListView autosize

3 posts, 0 answers
  1. Fatima
    Fatima avatar
    11 posts
    Member since:
    Oct 2011

    Posted 23 Aug 2012 Link to this post

    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. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 28 Aug 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Fatima
    Fatima avatar
    11 posts
    Member since:
    Oct 2011

    Posted 28 Aug 2012 Link to this post

    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));
    
Back to Top