Nested DataGrid Has an Extra column

3 posts, 0 answers
  1. Top Gun
    Top Gun avatar
    20 posts
    Member since:
    Nov 2009

    Posted 05 Feb 2012 Link to this post

    I have a hierarchical data grid. Each parent row may have an expand button.   When I click the expand button each parent row expands and displays a nested data grid.  My problem is that my nested data grid always has an extra column.  This extra column has no data.  How do I remove the extra column from my nested data grid?



    Xaml Below
    <Grid x:Name="LayoutRoot" Background="White">
            <Controls:RadGridView x:Name="PeopleGrid"  Margin="0"
                                 RowIndicatorVisibility="Collapsed" IsReadOnly="True" 
                                 Width="748" MinHeight="386" MaxHeight="400"
                                 AutoGenerateColumns="False"
                                 VerticalAlignment="Top" 
                                 VerticalContentAlignment="Stretch" 
                                 HorizontalContentAlignment="Stretch"  
                                 HorizontalAlignment="Stretch"                             
                                 >
                <Controls:RadGridView.Columns>                
                    <Controls:GridViewDataColumn >
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <Button x:Name="btnToggle"  Content="+" Click="btnToggle_Click" Tag="Inner" Visibility="{Binding IsToggleBtnVisible}"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                    </Controls:GridViewDataColumn>
                    <Controls:GridViewDataColumn Header="ID" DataMemberBinding="{Binding ID}" />
                    <Controls:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding FirstName}" />
                    <Controls:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding LastName}" />
                    <Controls:GridViewDataColumn Header="Major" DataMemberBinding="{Binding Major}" Width="*" />
                    <Controls:GridViewDataColumn Header="Age" DataMemberBinding="{Binding Age}" Width="120"/>
                </Controls:RadGridView.Columns>
                <telerik:RadGridView.RowDetailsTemplate>
                    <DataTemplate>
                        <Controls:RadGridView x:Name="ClassGrid"  Margin="0"
                                 ItemsSource="{Binding Path=ClassList, Mode=OneWay}"
                                 RowIndicatorVisibility="Collapsed" IsReadOnly="True"                            
                                 AutoGenerateColumns="False"
                                 VerticalAlignment="Top"                              
                                 HorizontalAlignment="Left"                             
                                 >
                            <Controls:RadGridView.Columns>
                                <Controls:GridViewDataColumn Header="Subject" DataMemberBinding="{Binding Subject}"  />
                                <Controls:GridViewDataColumn Header="Professor" DataMemberBinding="{Binding Professor}"  />
                                <Controls:GridViewDataColumn Header="Time" DataMemberBinding="{Binding Time}"  />
                            </Controls:RadGridView.Columns>
                        </Controls:RadGridView>
                    </DataTemplate>
                </telerik:RadGridView.RowDetailsTemplate>
            </Controls:RadGridView>
        </Grid>
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 06 Feb 2012 Link to this post

    Hi Amrit,

    Can you take a look at this article for a reference ? Does the approach illustrated there orrespond to your needs ?   


    Greetings,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Top Gun
    Top Gun avatar
    20 posts
    Member since:
    Nov 2009

    Posted 06 Feb 2012 Link to this post

    Thanks.  It looks like that works!
Back to Top