using MuchInfo.Chart.Infrastructure.Helpers; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace MuchInfo.Chart.WPF.Controls.Drawing { /// /// ChartToolbarExpander.xaml 的交互逻辑 /// public partial class ChartToolbarExpander : UserControl { #region Fields private ChartDrawingToolbar _chartDrawingToolbar; #endregion Fields #region Constructors public ChartToolbarExpander(ChartDrawingToolbar toolbar) { this.InitializeComponent(); this.imgDraw.Source = ImageHelper.GetImage("pencil.png"); _chartDrawingToolbar = toolbar; this.OnDrawingToolbarVisibleChanged(); _chartDrawingToolbar.VisibleChanged -= new ChartDrawingToolbar.VisibleChangedEventHandler(this.OnDrawingToolbarVisibleChanged); _chartDrawingToolbar.VisibleChanged += new ChartDrawingToolbar.VisibleChangedEventHandler(this.OnDrawingToolbarVisibleChanged); this.DrawTextBlock.FontSize = toolbar.FontSize; this.DrawTextBlock.Foreground = toolbar.Foreground; } #endregion Constructors #region Methods #region Private Methods private void borderHeader_MouseEnter(object sender, MouseEventArgs e) { this.borderHeader.BorderThickness = new Thickness(1.0); this.borderHeader.Padding = new Thickness(0.0); } private void borderHeader_MouseLeave(object sender, MouseEventArgs e) { this.borderHeader.BorderThickness = new Thickness(0.0); this.borderHeader.Padding = new Thickness(1.0); } private void borderHeader_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (_chartDrawingToolbar.Visible) { //if (!_chartDrawingToolbar.ShowNarrow && _chartDrawingToolbar.CanShowNarrow()) //{ // _chartDrawingToolbar.ShowNarrow = true; //} //else //{ // _chartDrawingToolbar.Visible = false; //} //this.DrawTextBlock.Visibility = Visibility.Collapsed; //this.pathDropArrow.Visibility = Visibility.Collapsed; //this.pathUpArrow.Visibility = Visibility.Collapsed; _chartDrawingToolbar.Visible = false; } else { _chartDrawingToolbar.Visible = true; //_chartDrawingToolbar.ShowNarrow = false; //this.DrawTextBlock.Visibility = Visibility.Visible; } } private void OnDrawingToolbarVisibleChanged() { bool visible = _chartDrawingToolbar.Visible; this.pathDropArrow.Visibility = Visibility.Collapsed; this.pathUpArrow.Visibility = Visibility.Collapsed; //bool flag = visible; //if (flag) //{ // this.pathDropArrow.Visibility = Visibility.Collapsed; // this.pathUpArrow.Visibility = Visibility.Visible; //} //else //{ // this.pathDropArrow.Visibility = Visibility.Visible; // this.pathUpArrow.Visibility = Visibility.Collapsed; //} } #endregion Private Methods #endregion Methods } }