Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I am using MVVM and I am binding both the Datagrid s by ObservableCollections on Viewmodel.</p> </blockquote> <p>You should have only one <code>ObservableCollection</code> (<code>MatchObsCollection</code>) in your ViewModel. If you have <code>MatchObsCollection</code> and <code>SubBetMatchDataListforChildGrid</code> in ViewModel this code doesn't work.</p> <p>The <code>DataContext</code> of the <code>RowDetails</code> is the row item.</p> <p>So if you want to binding to the <code>ObservableCollection</code> in the ViewModel you should use following code in <code>RowDetailsTemplate</code>:</p> <pre><code>... &lt;DataGrid.RowDetailsTemplate x:Uid="test123"&gt; &lt;DataTemplate x:Name="testTemplete"&gt; &lt;DataGrid x:Name="innerGrid" ItemsSource="{Binding Path=DataContext.SubBetMatchDataListforChildGrid, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" ... </code></pre> <p>If you want to binding to selected object inner <code>ObservableCollection</code> your classes should looks like this:</p> <pre><code>class Foo { public int MatchNo { get; set; } public DateTime MatchDate { get; set; } // more properties public ObservableCollection&lt;Boo&gt; SubBetMatchDataListforChildGrid { get; set; } } class Boo { public string Code { get; set; } public string SubOptions { get; set; } } </code></pre> <p>And in the ViewModel you should have <code>ObservableCollection</code> of Foo:</p> <pre><code>class MainViewModel { public ObservableCollection&lt;Foo&gt; MatchObsCollection { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload