I’m new to WPF, and I get error everytime I run my code
DoubleAnimation da = new DoubleAnimation();
TranslateTransform tt = (OPMenuScreen.RenderTransform as TransformGroup).Children[0] as TranslateTransform;
da.By = -250;
tt.BeginAnimation(TranslateTransform.XProperty, da);
Why can’t I get OPMenuScreen to move to a -250 Xproperty for TranslateTransform?
Following on from comments…
I’m not sure that the
Childrenproperty is null in your example – I think it’s more likely that either yourRenderTransformis null or it is not an instance ofTransformGroup. Either way, you should just need to make sure that you have the following specified in your XAML:Note: I have no idea what type
OPMenuScreenis, so I’ll useControlfor the example