2013年4月9日 星期二

NameScope 錯誤

Build WPF application from console mode:
1. Add Reference
    PresentationCore
    PresentationFramework
    WindowsBase
    System.XAML ( It may not be needed in VS 2008 ? not sure)
2.  Without SetNameScope, there may be animation without notice.
    //------ 要先註冊NameScope +++
    //System.Windows.NameScope.SetNameScope(this, new System.Windows.NameScope());
     this.RegisterName("旋轉物件名稱", 旋轉);
            System.Windows.Media.Animation.DoubleAnimation 動畫 =
                new System.Windows.Media.Animation.DoubleAnimation();
            動畫.From = 0;
            動畫.To = 360;
            動畫.Duration =
           new System.Windows.Duration(TimeSpan.FromMilliseconds(1500));
3. It may be found out by setting a break point after RegisterName since the code will not be executed.
4. 程式下載

沒有留言:

張貼留言