silverlight和wpf中暴露 给子类override

 protected virtual void OnSelectionChanged(SelectionChangedEventArgs args)
        {
        }

 

 1  public TestTabControl()
 2         {
 3             KeyEventHandler handler = null;
 4             SelectionChangedEventHandler handler2 = null;
 5             this._updateIndex = true;
 6             this.SelectedIndex = -1;
 7 
 8             
 9             if (handler == null)
10             {
11                 handler = (sender, e) => this.OnKeyDown(e);
12             }
13             base.KeyDown += handler;
14 
15             //make child can override SelectionChanged event
16             if (handler2 == null)
17             {
18                 handler2 = (sender, e) => this.OnSelectionChanged(e);
19             }
20             this.SelectionChanged += handler2;
21 
22 
23             base.IsEnabledChanged += new DependencyPropertyChangedEventHandler(this.OnIsEnabledChanged);
24             base.DefaultStyleKey = typeof(TestTabControl);
25 
26         }

 

posted @ 2013-09-11 10:39  法的空间  阅读(231)  评论(0编辑  收藏  举报