Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Surely you'd be missing out on something if you displayed all of these attributes and properties in one collection... How would you display the boxes around them? Surely you need multiple <code>ItemsControl</code>s to display the boxes?:</p> <pre><code>&lt;Grid Width="100" TextBlock.TextAlignment="Center"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;ItemsControl Grid.Row="0" BorderBrush="Black" BorderThickness="1" TextElement.FontWeight="Bold"&gt;Customer&lt;/ItemsControl&gt; &lt;ItemsControl Grid.Row="1" BorderBrush="Black" BorderThickness="1,0,1,1" ItemsSource="{Binding Attributes}" /&gt; &lt;ItemsControl Grid.Row="2" BorderBrush="Black" BorderThickness="1,0,1,1" ItemsSource="{Binding Properties}" /&gt; &lt;ItemsControl Grid.Row="3" BorderBrush="Black" BorderThickness="1,0,1,1" ItemsSource="{Binding Methods}" /&gt; &lt;/Grid&gt; </code></pre> <p>You could then extend this to hide sections that have no items in using a few extra properties and a <code>Converter</code>:</p> <pre><code>public bool HasMethods { return Methods.Count &gt; 0; } </code></pre> <p>Of course, you'll have to alert the <code>INotifyPropertyChanged.PropertyChangedEventHandler</code> to these properties when their related collections are updated. Then you could use it like this:</p> <pre><code> &lt;ItemsControl Grid.Row="3" BorderBrush="Black" BorderThickness="1,0,1,1" ItemsSource="{Binding Methods}" Visibility="{Binding HasMethods, Converter={StaticResource BoolToVisibilityConverter}}" /&gt; </code></pre>
 

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