Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a feature in Blend called <a href="http://blogs.msdn.com/b/expression/archive/2010/03/16/dynamic-layout-and-transitions-in-expression-blend-4.aspx" rel="nofollow">FluidLayout</a> that can do this. </p> <p>In Blend</p> <ul> <li>Create a new state group, set a transition duration and enable fluid layout.</li> <li>Create two states one for horizontal, one for vertical.</li> <li>You can then use a behaviour to toggle between them.</li> </ul> <p>If you don't have Blend you can download the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75E13D71-7C53-4382-9592-6C07C6A00207" rel="nofollow">SDK</a> which should have the required files Microsoft.Expression.Interactions and System.Windows.Interactivity. Add references to these and try the sample below.</p> <pre><code>&lt;Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Microsoft.Expression.Interactions" xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" x:Class="WpfApplication4.MainWindow" x:Name="Window" Title="MainWindow" Width="640" Height="480"&gt; &lt;Grid x:Name="LayoutRoot"&gt; &lt;VisualStateManager.CustomVisualStateManager&gt; &lt;ic:ExtendedVisualStateManager/&gt; &lt;/VisualStateManager.CustomVisualStateManager&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="Orientation" ic:ExtendedVisualStateManager.UseFluidLayout="True"&gt; &lt;VisualStateGroup.Transitions&gt; &lt;VisualTransition GeneratedDuration="00:00:00.3000000"/&gt; &lt;/VisualStateGroup.Transitions&gt; &lt;VisualState x:Name="Vertical"/&gt; &lt;VisualState x:Name="Horizontal"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="stack" Storyboard.TargetProperty="(StackPanel.Orientation)"&gt; &lt;DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Orientation.Horizontal}"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;StackPanel x:Name="stack" Margin="8,49,8,8"&gt; &lt;Button Content="Button"/&gt; &lt;Button Content="Button"/&gt; &lt;Button Content="Button"/&gt; &lt;Button Content="Button"/&gt; &lt;Button Content="Button"/&gt; &lt;/StackPanel&gt; &lt;Button HorizontalAlignment="Left" Margin="8,8,0,0" VerticalAlignment="Top" Width="97" Height="25" Content="H"&gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="Click"&gt; &lt;ic:GoToStateAction StateName="Horizontal"/&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;/Button&gt; &lt;Button HorizontalAlignment="Left" Margin="109,8,0,0" VerticalAlignment="Top" Width="97" Height="25" Content="V"&gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="Click"&gt; &lt;ic:GoToStateAction StateName="Vertical"/&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>You can use a similar method to handle the item transition using states to move the elements or by changing Grid.Row,RowSpan,Col. You may need some code to tie everything together. I'm looking at a more elaborate sample I'll post if I sort out the issues.</p>
    singulars
    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.
    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