WPF - data binding trigger before content changed
Posted
by 0xDEAD BEEF
on Stack Overflow
See other posts from Stack Overflow
or by 0xDEAD BEEF
Published on 2010-04-08T12:32:33Z
Indexed on
2010/04/08
12:33 UTC
Read the original article
Hit count: 283
How do i create trigger, which fires BEFORE binding changes value? How to do this for datatemplate?
<ContentControl Content="{Binding Path=ActiveView}" Margin="0,95,0,0">
<ContentControl.Triggers>
<--some triger to fire, when ActiveView is changing or has changed ?!?!? -->
</ContentControl.Triggers>
public Object ActiveView
{
get { return m_ActiveView; }
set {
if (PropertyChanging != null)
PropertyChanging(this, new PropertyChangingEventArgs("ActiveView"));
m_ActiveView = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("ActiveView"));
}
}
How to do this for DataTemplate?
<DataTemplate DataType="{x:Type us:LOLClass1}">
<ContentControl>
<ContentControl.RenderTransform>
<ScaleTransform x:Name="shrinker" CenterX="0.0" CenterY="0.0" ScaleX="1.0" ScaleY="1.0"/>
</ContentControl.RenderTransform>
<us:UserControl1/>
</ContentControl>
<DataTemplate.Triggers>
<-- SOME TRIGER BEFORE CONTENT CHANGES-->
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="shrinker" Storyboard.TargetProperty="ScaleX" From="1.0" To="0.8" Duration="0:0:0.3"/>
<DoubleAnimation Storyboard.TargetName="shrinker" Storyboard.TargetProperty="ScaleY" From="1.0" To="0.8" Duration="0:0:0.3"/>
</Storyboard>
</BeginStoryboard>
</-- SOME TRIGER BEFORE CONTENT CHANGES-->
</DataTemplate.Triggers>
</DataTemplate>
How to get notification BEFORE binding is changed? (i want to capture changing Visual component to bitmap and create sliding view animation)
© Stack Overflow or respective owner