source: trunk/PKCS1/WpfControls/Components/HelpTabItem.cs @ 1650

Last change on this file since 1650 was 1650, checked in by schomburg, 11 years ago

initial commit of PKCS1 Plugin

File size: 1.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7
8namespace PKCS1.WpfControls.Components
9{
10    public class HelpTabItem : TabItem
11    {
12        static HelpTabItem()
13        {
14            DefaultStyleKeyProperty.OverrideMetadata(typeof(HelpTabItem), new FrameworkPropertyMetadata(typeof(HelpTabItem)));
15        }
16
17        public static readonly RoutedEvent HelpButtonClickEvent = EventManager.RegisterRoutedEvent(
18            "HelpButtonClick", RoutingStrategy.Direct,
19            typeof(RoutedEventHandler), typeof(HelpTabItem));
20
21
22        public event RoutedEventHandler HelpButtonClick
23        {
24            add { AddHandler(HelpButtonClickEvent, value); }
25            remove { RemoveHandler(HelpButtonClickEvent, value); }
26        }
27
28        public override void OnApplyTemplate()
29        {
30            base.OnApplyTemplate();
31
32            Image helpButton = base.GetTemplateChild("PART_Close") as Image;
33            if (helpButton != null)
34                helpButton.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(helpButton_MouseLeftButtonDown);
35        }
36
37        void helpButton_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
38        {
39            this.RaiseEvent(new RoutedEventArgs(HelpButtonClickEvent, this));
40            e.Handled = true;
41        }
42    }
43}
Note: See TracBrowser for help on using the repository browser.