2013-01-15 96 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

回答