Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I figured out the things I was doing wrong. There were several things wrong. Here are the main points:</p> <p>1) I should have been using an itemsControl</p> <p>2) I didn't need to use HierarchicalDataTemplate</p> <p>3) I needed three levels of controls: a TextBox inside an itemsControl inside an itemsControl... and this can be accomplished using two DataTemplates. The top-level itemsControl refers to a DataTemplate that holds an inner itemsControl. That itemsControl then refers to a DataTemplate that holds an inner TextBox.</p> <p>And here is the correct xaml:</p> <pre><code>&lt;UserControl.Resources&gt; &lt;ResourceDictionary&gt; &lt;ObjectDataProvider x:Key="TheData" /&gt; &lt;DataTemplate x:Key="ElementTemplate"&gt; &lt;TextBox Text="{Binding Path=df_myValue}"/&gt; &lt;/DataTemplate&gt; &lt;DataTemplate x:Key="ElementSetTemplate"&gt; &lt;GroupBox Header="I am a GroupBox"&gt; &lt;ItemsControl ItemsSource="{Binding Path=df_elementSet}" ItemTemplate="{StaticResource ElementTemplate}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;/ItemsControl&gt; &lt;/GroupBox&gt; &lt;/DataTemplate&gt; &lt;/ResourceDictionary&gt; &lt;/UserControl.Resources&gt; &lt;Grid&gt; &lt;ItemsControl ItemsSource="{Binding Source={StaticResource TheData}, Path=df_basicSet}" ItemTemplate="{StaticResource ElementSetTemplate}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;/ItemsControl&gt; &lt;/Grid&gt; </code></pre> <p>Hope this helps someone else...</p>
 

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