Note that there are some explanatory texts on larger screens.

plurals
  1. POMatching vertical layout in different ItemsControls
    text
    copied!<p>I have <code>ListView</code> that uses a <code>GridView</code> to display several columns of data.</p> <p>Two of the columns have cell templates containing <code>ItemControl</code>'s to show a small collection in each cell.</p> <p>The problem I have is that the vertical size of the <code>ItemControl</code>s is not connected in any way since they are in different cells, and therefore they don't line up. </p> <p>eg:(note this is <strong>ONE ROW</strong> in the parent listview)</p> <p><img src="https://i.stack.imgur.com/oFDQH.jpg" alt=""></p> <p>XAML so far:</p> <pre><code>&lt;ListView Margin="6,6,6,0" ItemsSource="{Binding Controllers}"&gt; &lt;ListView.ItemContainerStyle&gt; &lt;Style TargetType="ListViewItem" &gt; &lt;Setter Property="VerticalContentAlignment" Value="Top" /&gt; &lt;/Style&gt; &lt;/ListView.ItemContainerStyle&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;!-- snip other columns --&gt; &lt;GridViewColumn Header="Mode"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ItemsControl ItemsSource="{Binding Modes}" DisplayMemberPath="Name"/&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Header="Parameters"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;ItemsControl ItemsSource="{Binding Modes}"&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="Blah:" Margin="5,0"/&gt; &lt;ComboBox&gt; &lt;ComboBoxItem&gt;Hello&lt;/ComboBoxItem&gt; &lt;/ComboBox&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; </code></pre> <p>My first thought was to use a grid as the <code>ItemsPanel</code> of the <code>ItemsControls</code>, so I could use SharedSizeScope on the rows to line them up. However, I can see no way of assigning items dynamically created by the ItemsControl to specific Grid rows.</p> <p>Can anyone suggest a better solution?</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