Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat xaml code to get this layout?
    primarykey
    data
    text
    <p>In a specific parent control of my page, I want to layout horizontally some child controls (let's say rectangles) so that each control has the same width and has a maximum width. This means that, given a large parent control:</p> <ul> <li>if there is only one child control, it won't span over the whole parent but will have its width set to the max width.</li> <li>After adding child controls, at a certain point, the sum of these max width (which the same for each child control btw) will be greater than the parent width. In this case, the total width should be divided by the number of children and each child will get this result.</li> </ul> <p>Because the parent control must be bound to a collection, I began to write this:</p> <pre><code>&lt;ItemsControl Margin="10" Height="200" ItemsSource="{Binding MyCollection}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Horizontal" /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;ChildShape /&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; </code></pre> <p>I quickly realized that the StackPanel is not what I want.</p> <p>The final goal is to have nice animations when a child is added or removed (other children must slide and change their size smoothly.</p> <p>Since I'm new to Silverlight, I can't see what panel (custom or not?) I should use or how I can achieve what I described.</p>
    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. 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