hierarchical radgridview expand one row at a time

5 posts, 1 answers
  1. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Hi I have a radgridview which contains a child radgridview. I want only one row to be expanded at a time, however I am having problems getting this done. Can someone please let me know the correct way on achieving this. Thanks
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 May 2012 Link to this post

    Hi,

     You can set the ExpandMode property of the GridViewToggleRowDetailsColumn to "Single". That way only a single row can be expanded at a time.

    Greetings,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

      <Telerik:RadGridView x:Name="staticDataRadGrid" IsSynchronizedWithCurrentItem="True"
                                SelectedItem="{Binding Path=EventCollectionDTO, Source={StaticResource vm}, Mode=TwoWay}"
                                CurrentItem="{Binding Path=EventCollectionDTO, Source={StaticResource vm}, Mode=TwoWay}"
                                 Grid.Row="1"  
                                AutoGenerateColumns="False" 
                                ItemsSource="{Binding PagedSource, ElementName=_radDataPager,Mode=TwoWay}" 
                                CanUserFreezeColumns="False" 
                                VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"                              ShowGroupPanel="False" SelectionMode="Single">
    <Telerik:RadGridView.Columns>
                       <Telerik:GridViewToggleRowDetailsColumn ExpandMode="Single"/>
                           <Telerik:GridViewDataColumn Header="Entity Name" TextWrapping="Wrap"  IsReadOnly="True" DataMemberBinding="{Binding EventHeader.EntityName}"    IsGroupable="False" Width="2*"/>
    </Telerik:RadGridView.Columns>
                       <Telerik:RadGridView.ChildTableDefinitions>
                           <Telerik:GridViewTableDefinition >
                               <Telerik:GridViewTableDefinition.Relation>
                                   <Telerik:TableRelation IsSelfReference="False">
                                       <Telerik:TableRelation.FieldNames>
                                           <Telerik:FieldDescriptorNamePair ParentFieldDescriptorName="ID" ChildFieldDescriptorName="EventID"/>
                                       </Telerik:TableRelation.FieldNames>
                                   </Telerik:TableRelation>
                               </Telerik:GridViewTableDefinition.Relation>
                           </Telerik:GridViewTableDefinition>
                       </Telerik:RadGridView.ChildTableDefinitions>
     <Telerik:RadGridView.HierarchyChildTemplate>
                           <DataTemplate>
                           <Telerik:RadGridView x:Name="staticDataEventDetailRadGrid" CanUserFreezeColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False"      MinWidth="800" MaxWidth="850" VerticalAlignment="Stretch" CurrentItem="{Binding Path=EventDetailDTO, Source={StaticResource vm}, Mode=TwoWay}" SelectedItem="{Binding Path=EventDetailDTO, Source={StaticResource vm}, Mode=TwoWay}"   Style="{StaticResource CustomRadGridViewStyle}"  AutoExpandGroups="False" IsSynchronizedWithCurrentItem="True"   AutoGenerateColumns="False" ItemsSource="{Binding EventDetails,Mode=TwoWay}"   ShowGroupPanel="False" IsReadOnly="True">
    <Telerik:RadGridView.Columns>
                                   <Telerik:GridViewToggleRowDetailsColumn ExpandMode="Single"/>
                                   <Telerik:GridViewDataColumn TextWrapping="Wrap"  DataMemberBinding="{Binding EventProcess, ValidatesOnExceptions=False, ValidatesOnDataErrors=False, ValidatesOnNotifyDataErrors=False,NotifyOnValidationError=False}" Header="Process" IsGroupable="False" Width="3*"/>
                                   </Telerik:RadGridView.Columns>
                               </Telerik:RadGridView>
                           </DataTemplate>
                       </Telerik:RadGridView.HierarchyChildTemplate>
                   </Telerik:RadGridView>

    Hi i tried this and it still didnt work, my xaml is pasted above incase it helps. Thanks
  4. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 May 2012 Link to this post

    Hi,

    The suggested approach will work with Row Details.  

    You use Hierarchy with ChildTableDefinitions. In that case you can handle RowIsExpandedChanged event of RadTreeListView and control the expand of the items.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Tingting
    Tingting avatar
    14 posts
    Member since:
    May 2012

    Posted 05 Jul 2012 Link to this post

    Hello, 

       I want to know how can i change the size of the icon witch is used to expand a row. 
      
    Thank you   
Back to Top