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

radgridview hierarchychildtemplate

0 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
peter
Top achievements
Rank 1
peter asked on 15 Mar 2012, 12:14 PM
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.
Tags
GridView
Asked by
peter
Top achievements
Rank 1
Share this question
or