Accessing XAML Object Variables in XAML
Posted
by
Asryael
on Stack Overflow
See other posts from Stack Overflow
or by Asryael
Published on 2012-11-09T22:52:40Z
Indexed on
2012/11/09
22:59 UTC
Read the original article
Hit count: 186
So, what I'm trying to do is access my Form's width and/or height to use in a storyboard. Essentially, I have a Translate Transform animation to slide what are essentially two pages. The animation works fine with hard coded From/To variables, however I need to use soft variables that enable the animation to start from the left/right of my form no matter what size it is.
<Storyboard x:Key="SlideLeftToRight"
TargetProperty="RenderTransform.(TranslateTransform.X)"
AccelerationRatio=".4"
DecelerationRatio=".4">
<DoubleAnimation Storyboard.TargetName="PageViewer" Duration="0:0:0.6" From="WindowWidth" To="0"/>
<DoubleAnimation Storyboard.TargetName="BorderVisual" Duration="0:0:0.6" From="0" To="NegativeWindowWidth"/>
</Storyboard>
However, I have no idea how to do so. Any help is greatly appreciated.
EDIT: I'm guessing it has something to do with:
From="{Binding Width, Source=MainWindow}"
However, when I attempt this, I don't know how to make it negative.
© Stack Overflow or respective owner