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

Child GridView expander visibility

5 Answers 385 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Evgenii
Top achievements
Rank 1
Evgenii asked on 31 Jul 2012, 01:26 PM
So, i have radGridView with child 
  <telerik:RadGridView x:Name="radGridView" Grid.Row="5" Grid.ColumnSpan="2"  CanUserFreezeColumns="False" ItemsSource="{Binding ParentCollection}" IsFilteringAllowed="False" AutoGenerateColumns="False" ShowGroupPanel="False" IsReadOnly="True">
                <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition/>
                </telerik:RadGridView.ChildTableDefinitions>
                <telerik:RadGridView.Columns>
                    <!--some columns -->
                </telerik:RadGridView.Columns>
                <telerik:RadGridView.HierarchyChildTemplate  >
                    <DataTemplate>
                        <telerik:RadGridView x:Name="nestedRadGridView" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding ChildCollection}" IsFilteringAllowed="False" ShowGroupPanel="False" IsReadOnly="True">
                            <telerik:RadGridView.Columns>
                     <!--some columns -->
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </DataTemplate>
                </telerik:RadGridView.HierarchyChildTemplate>
            </telerik:RadGridView>

need to hide expander of parent grid in rows which have empty child collection. Where i can set style of this togglebutton, tried HierarchyExpandButtonStyle but seems like my style is not applied.

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 31 Jul 2012, 01:44 PM
Hi,

 I would suggest you to check our custom hierarchy demo for more info. 

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Evgenii
Top achievements
Rank 1
answered on 31 Jul 2012, 02:00 PM
Where i can find this demo? 
0
Dimitrina
Telerik team
answered on 31 Jul 2012, 02:03 PM
Hi,

 You could download the WPF demos here. After you install them please search for "Custom Hierarchy".

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
lun
Top achievements
Rank 1
answered on 28 Jan 2015, 04:59 PM
Hi everyone,

I post a short reply to help those who want implement this functionality in xaml side only.
The goal is to set the property 'IsExpandable' dynamically via a DataTrigger :

<telerik:RadGridView.HierarchyChildTemplate>
  <DataTemplate>
    <telerik:RadGridView AutoGenerateColumns="False" ShowGroupPanel="False" RowIndicatorVisibility="Hidden" ShowColumnHeaders="False" ItemsSource="{Binding MySource}">
      <telerik:RadGridView.RowStyle>
        <Style TargetType="telerik:GridViewRow">
          <Setter Property="IsExpandable" Value="True"/>
          <Style.Triggers>
            <DataTrigger Binding="{Binding Path=HasItems}" Value="False">
              <Setter Property="IsExpandable" Value="False"/>
            </DataTrigger>
          </Style.Triggers>
        </Style>
      </telerik:RadGridView.RowStyle>
      <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding MyProperty}" />
      </telerik:RadGridView.Columns>
    </telerik:RadGridView>
  </DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>

regards,
Lun@ir
0
Boris
Telerik team
answered on 29 Jan 2015, 08:56 AM
Hello lun,

Thank you for sharing your approach with our community.

Regards,
Boris
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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