动画后的属性访问

时间:2018-12-05 10:06:46

标签: .net wpf

我有动画代码。

<TextBlock Grid.Row="1" VerticalAlignment="Top" FontSize="14"
                       Foreground="{Binding TextFill, Mode=OneWay}"
                       Text="{Binding Info, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                       hlprs:AnimatableTextHelper.ProtectionProperty="{Binding ToogleButtonIsChecked, Mode=OneWay, NotifyOnTargetUpdated=True}" TargetUpdated="TextBlock_TargetUpdated"/> 

TextBlock_TargetUpdated:

ColorAnimation animation = new ColorAnimation(Colors.Green, new Duration(TimeSpan.FromMilliseconds(1300)));
                animation.Completed += (s, e_) =>
                {
                    tmpSender.Foreground.BeginAnimation(SolidColorBrush.ColorProperty, null);

                    var b = tmpSender.GetBindingExpression(TextBlock.ForegroundProperty);
                }; 
                animation.FillBehavior = FillBehavior.Stop;
                tmpSender.Foreground.BeginAnimation(SolidColorBrush.ColorProperty, animation);

动画后,我无法通过绑定和b == null来更新属性。 我希望该属性从dataconttext请求当前值

我在做什么错了?

0 个答案:

没有答案