Prism StockTrader RI アプリケーションのようなユーザー インターフェイスがあり、コントロール パネルを ResearchRegion に配置すると、アイテムのリストが含まれ、その詳細がメイン リージョンの AnimatedTabControl に表示されます。AnimatedTabControl (StockTrader RI から) を次のようにカスタマイズする必要があります。
AnimatedTabControl は、通常のタブ コントロールのようにタブ ヘッダーを表示します。ヘッダーには、選択した項目名が含まれます。
ResearchRegion にあるコントロール パネルから新しい選択が適用されると、新しいタブが開き、前のタブの選択が削除されず、アニメーションも表示されない
タブヘッダーには、必要に応じて開いているタブを閉じるための閉じるボタンが含まれています
アニメーションは、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; } } }
前もって感謝します