1
Ben bir pencere yöntemi içinde bu kodu var (AddServer bir kullanıcı kontrolü)ThicknessAnimation ınvalidoperationexception
addServer = new AddServer();
addServer.Height = 300;
addServer.Width = 570;
this.RegisterName("addServerPanel", addServer);
Main.Children.Add(addServer);
// 252, 248, 26, 0
addServer.Margin = new Thickness(252, 550, 26, 0);
ThicknessAnimation thicknessAnimation = new ThicknessAnimation();
thicknessAnimation.From = new Thickness(252, 550, 26, 0);
thicknessAnimation.To = new Thickness(252, 248, 26, 0);
thicknessAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
Storyboard.SetTargetName(thicknessAnimation, "addServerPanel");
Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty));
Storyboard storyboard = new Storyboard();
storyboard.Children.Add(thicknessAnimation);
storyboard.Begin();
Ve film şeridi başlar başlamak için çalıştığımda bir InvalidOperationException olsun. Bu, addServerPanel
ismini çözemediğini, bu yüzden pencerenin usercontrol adını kaydetmediğini söylüyor. Bunu nasıl düzeltebilirim? Bunun yerine, hedef adını kullanmanın
sen [set hedef] (https://msdn.microsoft.com/en-us/ çalıştı mı
addServer
nesneye doğrudan ayarlamak içinSetTarget
yöntemi kullanabilirsiniz hedef adı kullanmak yerine "addServer" kütüphanesi/windows/apps/windows.ui.xaml.media.animation.storyboard.settarget)? – dkozlTeşekkürler! İşe yaradı. Bunu bir cevap olarak ekleyin ve onu onaylayacağım. – chris579