radgridview hierarchychildtemplate

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

    Posted 15 Mar 2012 Link to this post

    Hi is there a working example of a child gridview which is loaded on demand and uses mvvm. The problem i am getting so far is the fact that when i expand a row it works fine, however if i expand another row both expanded rows now show the same data which is obviously wrong.

    <Telerik:RadGridView x:Name="staticDataRadGrid" 
                               SelectedItem="{Binding EventDTO,Source={StaticResource vm},Mode=TwoWay}"   
                               AutoGenerateColumns="False" ItemsSource="{Binding PagedSource, ElementName=_radDataPager}" 
                               CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False" VerticalAlignment="Bottom" Margin="0,0,0,120">
              <i:Interaction.Behaviors>
                  <ClassLibrary:EmptyDataTemplateBehavior>
                      <ClassLibrary:EmptyDataTemplateBehavior.EmptyDataTemplate>
                          <DataTemplate>
                              <TextBlock Text="No results found!" Foreground="Black" FontSize="20"  HorizontalAlignment="Center"  VerticalAlignment="Center" Visibility="{Binding NoResultsVisibility,Source={StaticResource vm}}"  />
                          </DataTemplate>
                      </ClassLibrary:EmptyDataTemplateBehavior.EmptyDataTemplate>
                  </ClassLibrary:EmptyDataTemplateBehavior>
              </i:Interaction.Behaviors>
              <i:Interaction.Triggers>
                  <i:EventTrigger EventName="RowIsExpandedChanged">
                      <i:InvokeCommandAction Command="{Binding LoadCommand,Source={StaticResource EventDetailViewModel}}" CommandParameter="{Binding SelectedItem,ElementName=staticDataRadGrid}"></i:InvokeCommandAction>
                  </i:EventTrigger>
              </i:Interaction.Triggers>
              <Telerik:RadGridView.Columns>
                  <Telerik:GridViewDataColumn Header="Entity Name"  IsReadOnly="True" DataMemberBinding="{Binding EntityName}" Width="*"/>
                  <Telerik:GridViewDataColumn Header="Entity Mail Address" IsReadOnly="True" DataMemberBinding="{Binding EmailAddress}" Width="*"/>
                  <Telerik:GridViewDataColumn Header="Event Type" IsReadOnly="True" DataMemberBinding="{Binding EventTypeName}" Width="*"/>
                  <Telerik:GridViewDataColumn Header="Initiated By" IsReadOnly="True" DataMemberBinding="{Binding InitiatedBy}" Width="*"/>
                  <Telerik:GridViewDataColumn Header="Date Initiated" IsReadOnly="True" DataMemberBinding="{Binding SentDate}" Width="*"/>
                  <Telerik:GridViewDataColumn Header="Current State" IsReadOnly="True" DataMemberBinding="{Binding EventState}" Width="*"/>
                              </Telerik:RadGridView.Columns>
              <Telerik:RadGridView.ChildTableDefinitions>
                  <Telerik:GridViewTableDefinition />
              </Telerik:RadGridView.ChildTableDefinitions>
              <Telerik:RadGridView.HierarchyChildTemplate>
                  <DataTemplate>
                      <Telerik:RadGridView x:Name="staticDataEventDetailRadGrid"   BorderThickness="0,1,0,1" GridLinesVisibility="None" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding EventDetailDTOs,Source={StaticResource vm}}"  ShowGroupPanel="False" IsReadOnly="True">
                          <Telerik:RadGridView.Columns>
                              <Telerik:GridViewDataColumn DataMemberBinding="{Binding EventProcessName}" Header="Process" />
                              <Telerik:GridViewDataColumn DataMemberBinding="{Binding FormName}" Header="Form Name" />
                          </Telerik:RadGridView.Columns>
                      </Telerik:RadGridView>
                  </DataTemplate>
              </Telerik:RadGridView.HierarchyChildTemplate>
          </Telerik:RadGridView>

    I am also using observablecollections which I am guessing is the issue, because once I expand another row, each row is now updated with the changed values.
Back to Top