| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using System.Windows.Media;
- namespace MuchInfo.Chart.Infrastructure.Controls
- {
- /// <summary>
- /// BorderedTextButton.xaml 的交互逻辑
- /// </summary>
- public partial class BorderedTextButton : UserControl
- {
- #region Constructors
- public BorderedTextButton()
- {
- this.InitializeComponent();
- }
- #endregion Constructors
- #region Delegates
- public delegate void ClickEventHandler(MouseEventArgs e);
- #endregion Delegates
- #region Events
- public event BorderedTextButton.ClickEventHandler Click;
- #endregion Events
- #region Properties
- #region Public Properties
- public Brush ButtonBackground
- {
- get
- {
- return this.borderButton.Background;
- }
- set
- {
- this.borderButton.Background = value;
- }
- }
- public Brush ButtonBorderBrush
- {
- get
- {
- return this.borderButton.BorderBrush;
- }
- set
- {
- this.borderButton.BorderBrush = value;
- }
- }
- public string Text
- {
- get
- {
- return this.theText.Text;
- }
- set
- {
- this.theText.Text = value;
- }
- }
- #endregion Public Properties
- #endregion Properties
- #region Methods
- #region Protected Methods
- protected virtual void OnClick(MouseEventArgs e)
- {
- ClickEventHandler handler = Click;
- if (handler != null) handler(e);
- }
- #endregion Protected Methods
- #region Private Methods
- private void borderButton_MouseEnter(object sender, MouseEventArgs e)
- {
- borderButton.BorderThickness = new Thickness(3.0);
- borderButton.Padding = new Thickness(5.0, 3.0, 5.0, 3.0);
- }
- private void borderButton_MouseLeave(object sender, MouseEventArgs e)
- {
- borderButton.BorderThickness = new Thickness(2.0);
- borderButton.Padding = new Thickness(6.0, 4.0, 6.0, 4.0);
- }
- private void borderButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- OnClick(e);
- }
- #endregion Private Methods
- #endregion Methods
- }
- }
|