How to animate visibility of a StackPanel in Silverlight to expand and collapse?

In my case, I would like the expand/collapse to happen from left to right and right to left respectively.

The animation should happen when the visibility changes.

Thank you.

-------------Problems Reply------------

You could create two animation storyboards (One for expanding and one for Collapsing) that animates the Width of the stackpanel, then on StackPanel_VisibilityChanged run the appropriate animation.

I recommend animating on the Width property rather than ScaleX. Otherwise the entire control (StackPanel) will look crunched/stretched as its animating.

Category:wpf Views:0 Time:2010-07-16

Related post

  • How do you set the visibility of a StackPanel in WP7 using MVVM Light? 2011-05-13

    I've been trying to set the visibility of a stackpanel from my viewmodel but haven't had much luck. Heres my XAML: <StackPanel Visibility="{Binding Path=IsVisible}"/> Note: I have successfully connected my view to my viewmodel. All my other pro

  • can we animate visibility? 2012-02-16

    $(".leftNav").animate({"visibility": "visible"}, 200); I tried it and it doesn't work and I can't use .show() If I should be using .show() tho, another solution which may solve my issue is rather in regards of css and the question it'd be: Can i posi

  • how to add mouserightbuttondown event to stackpanel in silverlight 3 2010-08-11

    how to add mouserightbuttondown event to stackpanel in silverlight 3 --------------Solutions------------- In Silverlight 3 its quite tricky, probably the best solution all other things being equal is start using Silverlight 4. However I guess you wou

  • Animate visibility modes, GONE and VISIBLE 2010-10-28

    So im trying to animate when i set the visibility of a linearlayout with other widgets, from GONE to VISIBLE and the opposite.Im using togglebuttons to show and hide. Here's an image to show what i want to do: I can show and hide, but im not followin

  • Changing Visibility in a StackPanel 2011-03-07

    I have a WPF StackPanel that looks like this: (some attributes removed that don't matter) <StackPanel HorizontalAlignment="Center" Name="PICStack"> <Label Name="PICName" MouseDoubleClick="PICName_MouseDoubleClick" /> <TextBox Name="PIC

  • Can you animate a custom dependency property in Silverlight? 2008-09-15

    I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they have to be DPs because I want to be able to animate them.) However, when

  • Is it possible to animate the vertical size of the Silverlight plugin? 2008-12-02

    Would like to have the plugin change size as part of an internal Silverlight animation. Possible? Can't seem to find answer. Thx. --------------Solutions------------- You probably don't want to do that. You're much better off having the plugin take u

  • How to add a ScrollBar to a StackPanel in Silverlight? 2010-04-22

    I have a Grid, 3 by 3 (3 RowDefinitions and 3 ColumnDefinitions). I want some content (a StackPanel) in one of those grid cells to scroll. I'm fairly sure this is possible but I cannot figure out how. I've tried adding ScrollViewers and ScrollBar con

  • Setting Visibility using MVVM pattern in silverlight 2010-06-23

    I take one grid in silverlight. Initially textbox2 is invisible. When I click on textbox1 we have to visible textbox2. I try it as belows: <TextBox x:Name="textbox1" SelectionChanged="txt1_SelectionChanged"/> <TextBox x:Name="textbox2 " Visi

  • How can I animate a property dynamically in a Silverlight 4 UserControl? 2010-11-17

    I've run into a puzzling limitation in a Silverlight 4 UserControl. What I'm trying to achieve is to have a panel, which slides out from a minimised state when a button is pressed, but the title bar of it should be draggable with which this maximised

  • How to: animate a MVVM ViewModel property in Silverlight 4? 2011-04-18

    I'd like to ask how, if possible, do you animate a property on a MVVM viewmodel in Silverlight. For example, here I have a typical Storyboard declaration in XAML: <DoubleAnimation Storyboard.TargetName="yearSlider" Storyboard.TargetProperty="Value

  • Combobox not visible to code behind in Silverlight 2011-03-28

    I have been trying to add items to a comboxbox but cannot seem to get the code behind file to recognize the combobox added to the xaml. I am pretty sure I am missing something simple. Basically the xaml here illustrates an empty combobox. The code be

  • How to modify this javascript code to only expand the hidden text 2010-07-31

    I want to expand hidden text on a webpage and after some (re)search on google i came across the following code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> <html xmlns="http:/

  • Child Expanders raising Parent Expander's Expanded and Collapsed Events? 2011-05-18

    For some reason, child Expanders (placed in a StackPanel inside of another Expander), when collapsed or expanded, cause the parent Expander to raise its Expanded or Collapsed events. Anyone know why this is or how I can change it? I'm only interested

  • Bind StackPanel.Visibility to the Visibility property of its children 2009-02-20

    I'm relatively new to DataBinding and just reading into it. What I want to do is the following: I have a StackPanel with a number of child controls: <StackPanel Orientation="Horizontal"> <TextBox x:Name="textbox1" Width="100">1</TextBo

  • stackpanel triggers and storyboard 2012-04-15

    When setting my stackpanel triggers for my expander content I begin a story board animation but how can I use the story board animation the same way in reverse? <BeginStoryboard> <Storyboard> <DoubleAnimation From="0" To="1.2" Duration

  • How do I animate View.setVisibility(GONE) 2010-04-14

    I want to make an Animation for when a View gets it's visibility set to GONE. Instead of just dissapearing, the View should 'collapse'. I tried this with a ScaleAnimation but then the View is collapse, but the layout will only resize it's space after

  • DataBound ListBox and Button inside a ScrollViewer/StackPanel construct, with Button appearing below end of ListBox content 2010-08-27

    I have the following construct, which shows a DataBound ListBox and a Button inside a StackPanel, which again is placed inside a ScrollViewer: <ScrollViewer VerticalScrollBarVisibility="Visible" Height="400"> <StackPanel Orientation="Vertica

  • Adjust the Visibility property of a View not working 2011-02-04

    I've a strange problem with binding a boolean property to a View's Visibility property. I have a 'main' View that contains a bunch of other Views as well as various other UIElements including Buttons, TextBoxes, Grids, StackPanels and some telerik co

Copyright (C), All Rights Reserved.

processed in 0.193 (s). 11 q(s)