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