2013-01-15 131 views
0

我有這樣的一些變化whrere 我把控制面板ResearchRegion包含的項目列表,當我選擇一個項目 其詳細信息將顯示在AnimatedTabControl在主棱鏡StockTrader RI應用程序的用戶界面地區。 我需要定製AnimatedTabControl(從StockTrader RI)是這樣的:棱鏡AnimatedTabControl定製

  • 的AnimatedTabControl顯示選項卡頭像正常標籤控制,其中當應用新的選擇頭 將包含所選擇的項目名稱

  • 從位於ResearchRegion中的控制面板開始 新標籤頁打開而不移除上一個標籤頁選項和不帶動畫

  • 標籤頁眉包含關閉按鈕以關閉任何打開的ta只需要事先在ResearchRegion改變控制面板

    public class AnimatedTabControl : TabControl 
    { 
        public static readonly RoutedEvent SelectionChangingEvent =  EventManager.RegisterRoutedEvent(
         "SelectionChanging", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof (AnimatedTabControl)); 
    
        private DispatcherTimer timer; 
    
        public AnimatedTabControl() 
        { 
         DefaultStyleKey = typeof(AnimatedTabControl); 
        } 
    
        public event RoutedEventHandler SelectionChanging 
        { 
         add { AddHandler(SelectionChangingEvent, value); } 
         remove { RemoveHandler(SelectionChangingEvent, value); } 
        } 
    
        protected override void OnSelectionChanged(SelectionChangedEventArgs e) 
        { 
         this.Dispatcher.BeginInvoke(
          (Action)delegate 
          { 
           this.RaiseSelectionChangingEvent(); 
    
           this.StopTimer(); 
    
           this.timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0,  500) }; 
    
           EventHandler handler = null; 
           handler = (sender, args) => 
           { 
            this.StopTimer(); 
            base.OnSelectionChanged(e); 
           }; 
           this.timer.Tick += handler; 
           this.timer.Start(); 
          }); 
        } 
    
        // This method raises the Tap event 
        private void RaiseSelectionChangingEvent() 
        { 
         var args = new RoutedEventArgs(SelectionChangingEvent); 
         RaiseEvent(args); 
        } 
    
        private void StopTimer() 
        { 
         if (this.timer != null) 
         { 
          this.timer.Stop(); 
          this.timer = null; 
         } 
        } 
    } 
    

    感謝時

  • 動畫發生時BS

回答