WPF - data binding trigger before content changed
- by 0xDEAD BEEF
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)