0

I have a user interface like Prism StockTrader RI application with some changes whrere i put control panel in ResearchRegion contains list of items when i select one item its details are displayed in the AnimatedTabControl in the main region. I need to customize the AnimatedTabControl (from StockTrader RI) like this:

  • The AnimatedTabControl show tab header like normal tab control where header will contain the selected item name

  • When new selection is applied from a control panel that resides in the ResearchRegion a new tab open w/o removing the previous tab selection and w/o animation

  • Tab header contain close button to close any of the open tabs when required

  • Animation take place only when changing the control panel in the 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;
            }
        }
    }
    

    Thanks in Advance

4

1 回答 1

0

我已经回答了您问题的第 3 部分(选项卡标题包含关闭按钮,可在需要时关闭任何打开的选项卡)。

看看我在 SkyDrive 帐户中的公用文件夹:- ( https://skydrive.live.com/redir?resid=656548C49A72B6CD!105 )

于 2013-03-10T15:59:16.083 回答