GridViewColumn Width * (Star) in HierarchyChildTemplate

2 posts, 0 answers
  1. Bruno
    Bruno avatar
    54 posts
    Member since:
    Jul 2012

    Posted 31 Dec 2012 Link to this post

    Hi

    If I have a GridView with a HierarchyChildTemplate of Type GridView and this GridView has a GridViewColumn with Width in * (Star), the Width of the GridView is too long.

    Example:

    <telerik:RadGridView x:Name="TestGridView" AutoGenerateColumns="False">
             <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="LastName" DataMemberBinding="{Binding LastName}" Width="500"/>
                <telerik:GridViewDataColumn Header="FirstName" DataMemberBinding="{Binding FirstName}" Width="200"/>
             </telerik:RadGridView.Columns>
             <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition/>
             </telerik:RadGridView.ChildTableDefinitions>
             <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                   <telerik:RadGridView ItemsSource="{Binding Addresses}" AutoGenerateColumns="False">
                      <telerik:RadGridView.Columns>
                         <telerik:GridViewDataColumn Header="Street" DataMemberBinding="{Binding Street}" Width="3*"/>
                         <telerik:GridViewDataColumn Header="PostCode" DataMemberBinding="{Binding PostCode}" Width="*"/>
                         <telerik:GridViewDataColumn Header="City" DataMemberBinding="{Binding City}" Width="2*"/>
                      </telerik:RadGridView.Columns>
                   </telerik:RadGridView>
                </DataTemplate>
             </telerik:RadGridView.HierarchyChildTemplate>
          </telerik:RadGridView>

     

    Now, the width of the inner GridView is too long. How could I make that the inner Grid has the same Width like the outer one? (without fix width)

    Thank you, kind regards
    Bruno

     

  2. Yoan
    Admin
    Yoan avatar
    1214 posts

    Posted 02 Jan 2013 Link to this post

    Hello Bruno, 

    In order to achieve your goal, I can suggest you to bind the child GridView's Width to the one of its parent. Please take a look at this forum thread for a reference.

    All the best,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top