示例#1
0
文件: TZSideKPI.cs 项目: zkg642/JXXZ
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _arrowsImage = base.GetTemplateChild(ARROWS_IMAGE_NAME) as Arrows;
     _borderPenal = base.GetTemplateChild(BORDER_NAME) as Border;
     if (_arrowsImage != null)
     {
         _arrowsImage.MouseLeftButtonUp += _arrows_MouseLeftButtonUp;
     }
 }
示例#2
0
文件: TZSideKPI.cs 项目: zkg642/JXXZ
        private void _arrows_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Arrows arr = sender as Arrows;

            if (arr.path.Visibility == Visibility.Visible)
            {
                arr.path.Visibility  = Visibility.Collapsed;
                arr.path2.Visibility = Visibility.Visible;
            }
            else
            {
                arr.path.Visibility  = Visibility.Visible;
                arr.path2.Visibility = Visibility.Collapsed;
            }

            int offActualWidth = 23;//Arrows 的 Height + margin.left=23 待优化

            if (this._onActualWidth == 0)
            {
                this._onActualWidth = _borderPenal.ActualWidth - offActualWidth;
            }
            if (this._offActualWidth == 0)
            {
                this._offActualWidth = offActualWidth;
            }
            double actualWidth = 0;

            if (!this._isCollapse)
            {
                actualWidth = 0;
            }
            else
            {
                actualWidth = _onActualWidth;
            }
            _borderPenal.Margin = new Thickness(actualWidth, _borderPenal.Margin.Top, _borderPenal.Margin.Right, _borderPenal.Margin.Bottom);
            this._isCollapse    = !this._isCollapse;
        }