SebastianR
SebastianR

Reputation: 2193

Animating the SplitView.OpenPaneLength in UWP

I use the SplitView control in UWP and want to increase the width of the SplitView if the user clicks on certain top-level items in it. The SplitView should display a second level of options. Microsoft's UWP Mail App does something like this: if you click on "Folders", you get a list of all available folders as an extension to the SplitView. This extension is nicely animated.

I can easily increase the SplitView's OpenPaneLength with a setter like this:

<Setter Target="MainSplitView.(SplitView.OpenPaneLength)" Value="260"/>

Put this doesn't animate the changes. Is it possible to do this?

Upvotes: 0

Views: 449

Answers (1)

Igor Ralic
Igor Ralic

Reputation: 15006

The setter sets discrete values, so you need to use a Storyboard (VisualState.Storyboard) and a DoubleAnimation, something like this: (haven't tested it, but it should give you the idea...)

<DoubleAnimation Storyboard.TargetName="MainSplitView"
                 Storyboard.TargetProperty="(SplitView.OpenPaneLength)"
                 To="260" />

Upvotes: 3

Related Questions