2016-04-14 61 views
-1

我有一個內置的動畫如何使用內置的動畫UWP

protected virtual void SetUpPageAnimation() 
{ 
    TransitionCollection collection = new TransitionCollection(); 
    NavigationThemeTransition theme = new NavigationThemeTransition(); 

    var info = new ContinuumNavigationTransitionInfo(); 

    theme.DefaultNavigationTransitionInfo = info; 
    collection.Add(theme); 
    this.Transitions = collection; 
} 

我停靠的MainPage的構造這個方法,但我得到的錯誤:

'MainPage.SetUpPageAnimation()' is a new virtual member in sealed class 'MainPage'

什麼是錯在這裏? UPDATE - >我在XAML像這樣添加了動畫,它是工作:

<Page.Transitions> 
    <TransitionCollection> 
     <NavigationThemeTransition> 
      <NavigationThemeTransition.DefaultNavigationTransitionInfo> 
       <SlideNavigationTransitionInfo/> 
      </NavigationThemeTransition.DefaultNavigationTransitionInfo> 
     </NavigationThemeTransition> 
    </TransitionCollection> 
</Page.Transitions> 

回答

0

密封類不能被用作基類。因此,在密封的類中使用虛擬方法是沒有用的。

0

你不能在密封的類中有虛擬方法。

MSDN說:

A sealed class cannot be used as a base class, and a virtual method has to be implemented in a derived class, which is a contradiction.

相關問題