private void CreatePopupEx()
        {
            if (_apErrorToolTip.IsNull())
            {
                _apErrorToolTip = new ToolTip();
                _apErrorToolTip.BorderThickness          = new Thickness(0);
                _apErrorToolTip.Background               = new SolidColorBrush(Colors.Transparent);
                _apErrorToolTip.Padding                  = new Thickness(0);
                _apErrorToolTip.Placement                = PlacementMode.Top;
                _apErrorToolTip.Padding                  = new Thickness(0, 0, 0, 10);
                _apErrorToolTip.HorizontalOffset         = 0;
                _apErrorToolTip.VerticalOffset           = 0;
                _apErrorToolTip.Opened                  += popup_Opened;
                _apErrorToolTip.PlacementTarget          = this.AssociatedObject;
                _apErrorToolTip.VerticalContentAlignment = VerticalAlignment.Center;

                if (at.IsNull())
                {
                    at               = new AyTooltip();
                    at.BorderBrush   = SolidColorBrushConverter.From16JinZhi("#B2C9DE");
                    at.Foreground    = SolidColorBrushConverter.From16JinZhi("#FF3737");
                    at.Background    = SolidColorBrushConverter.From16JinZhi("#F3FAFD");
                    at.Placement     = Dock.Bottom;
                    _tb              = new TextBlock();
                    _tb.TextWrapping = TextWrapping.Wrap;
                    _tb.FontSize     = 12;
                    _tb.Foreground   = at.Foreground;

                    at.TooltipContent       = _tb;
                    _apErrorToolTip.Content = at;
                }
            }
        }
        private static void DockChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AyTooltip t = d as AyTooltip;

            if (t != null)
            {
                switch (t.Placement)
                {
                case Dock.Left:
                    t.RectangleMargin            = new Thickness(0, 0, 0, 0);
                    t.SanJiaoAngle               = 270;
                    t.SanJiaoMargin              = new Thickness(-11, 0, 0, 0);
                    t.ContentMargin              = new Thickness(12, 8, 16, 8);
                    t.SanJiaoVerticalAlignment   = VerticalAlignment.Center;
                    t.SanJiaoHorizontalAlignment = HorizontalAlignment.Left;
                    t.SanJiaoWidth               = 14;
                    t.SanJiaoHeight              = 9;
                    break;

                case Dock.Top:
                    t.RectangleMargin            = new Thickness(0, 8, 0, 0);
                    t.SanJiaoAngle               = 0;
                    t.SanJiaoMargin              = new Thickness(17, -4, 0, 0);
                    t.ContentMargin              = new Thickness(8, 16, 8, 8);
                    t.SanJiaoVerticalAlignment   = VerticalAlignment.Top;
                    t.SanJiaoHorizontalAlignment = HorizontalAlignment.Left;
                    t.SanJiaoWidth               = 20.25;
                    t.SanJiaoHeight              = 12.29;

                    break;

                case Dock.Right:
                    t.RectangleMargin            = new Thickness(0, 0, 0, 0);
                    t.SanJiaoAngle               = 90;
                    t.SanJiaoMargin              = new Thickness(0, 0, -11, 0);
                    t.ContentMargin              = new Thickness(12, 8, 16, 8);
                    t.SanJiaoVerticalAlignment   = VerticalAlignment.Center;
                    t.SanJiaoHorizontalAlignment = HorizontalAlignment.Right;
                    t.SanJiaoWidth               = 14;
                    t.SanJiaoHeight              = 9;
                    break;

                case Dock.Bottom:
                    t.RectangleMargin            = new Thickness(0, 0, 0, 8);
                    t.SanJiaoAngle               = 180.00;
                    t.SanJiaoMargin              = new Thickness(17, 0, 0, -4.0);
                    t.ContentMargin              = new Thickness(8, 8, 8, 16);
                    t.SanJiaoVerticalAlignment   = VerticalAlignment.Bottom;
                    t.SanJiaoHorizontalAlignment = HorizontalAlignment.Left;
                    t.SanJiaoWidth               = 20.25;
                    t.SanJiaoHeight              = 12.29;

                    break;

                default:

                    break;
                }
            }
        }
Beispiel #3
0
        private void CreatePopupEx()
        {
            if (_apErrorToolTip.IsNull())
            {
                _apErrorToolTip                          = new ToolTip();
                _apErrorToolTip.MinHeight                = this.Height == double.NaN ? this.Height : 0;
                _apErrorToolTip.BorderThickness          = new Thickness(0);
                _apErrorToolTip.Background               = new SolidColorBrush(Colors.Transparent);
                _apErrorToolTip.Padding                  = new Thickness(0);
                _apErrorToolTip.Placement                = PlacementMode.Right;
                _apErrorToolTip.Padding                  = new Thickness(10, 0, 0, 0);
                _apErrorToolTip.HorizontalOffset         = 0;
                _apErrorToolTip.VerticalOffset           = 0;
                _apErrorToolTip.Opened                  += ErrorPopup_Opened;
                _apErrorToolTip.PlacementTarget          = this;
                _apErrorToolTip.VerticalContentAlignment = VerticalAlignment.Center;

                this.LostKeyboardFocus += this_LostKeyboardFocus;
                this.GotKeyboardFocus  += this_GotKeyboardFocus;
                if (at.IsNull())
                {
                    at = new AyTooltip();

                    Binding _at1 = new Binding {
                        Path = new PropertyPath("AyToolTipForeground"), Source = this, Mode = BindingMode.TwoWay
                    };
                    Binding _at2 = new Binding {
                        Path = new PropertyPath("AyToolTipBackground"), Source = this, Mode = BindingMode.TwoWay
                    };
                    Binding _at3 = new Binding {
                        Path = new PropertyPath("AyToolTipBorderBrush"), Source = this, Mode = BindingMode.TwoWay
                    };
                    at.SetBinding(AyTooltip.BorderBrushProperty, _at3);
                    at.SetBinding(AyTooltip.ForegroundProperty, _at1);
                    at.SetBinding(AyTooltip.BackgroundProperty, _at2);
                    at.Placement = Dock.Left;
                    at.SetBinding(AyTooltip.TooltipContentProperty, new Binding {
                        Path = new PropertyPath("ErrorInfo"), Source = this, Mode = BindingMode.TwoWay
                    });
                    _apErrorToolTip.Content = at;
                }
            }
        }
Beispiel #4
0
        private void CreatePopupEx()
        {
            if (_apUserToolTip.IsNull())
            {
                _apUserToolTip = new ToolTip();
                _apUserToolTip.BorderThickness          = new Thickness(0);
                _apUserToolTip.Background               = new SolidColorBrush(Colors.Transparent);
                _apUserToolTip.Padding                  = new Thickness(0);
                _apUserToolTip.Placement                = PlacementMode.Left;
                _apUserToolTip.Padding                  = new Thickness(0, 0, 10, 0);
                _apUserToolTip.HorizontalOffset         = 0;
                _apUserToolTip.VerticalOffset           = 0;
                _apUserToolTip.Opened                  += popup_Opened;
                _apUserToolTip.PlacementTarget          = this.AssociatedObject;
                _apUserToolTip.VerticalContentAlignment = VerticalAlignment.Center;

                if (at.IsNull())
                {
                    at             = new AyTooltip();
                    at.RadiusX     = 3;
                    at.RadiusY     = 3;
                    at.BorderBrush = SolidColorBrushConverter.From16JinZhi("#333333");
                    at.MaxWidth    = 150;
                    at.Foreground  = SolidColorBrushConverter.From16JinZhi("#333333");
                    at.Background  = SolidColorBrushConverter.From16JinZhi("#FFFFFF");
                    at.Placement   = Dock.Right;
                    _tb            = new TextBlock();
                    //_tb.Margin = new Thickness(2,2,0,2);
                    _tb.TextWrapping = TextWrapping.Wrap;
                    _tb.FontSize     = 12;
                    _tb.SetBinding(TextBlock.ForegroundProperty, new Binding {
                        Path = new PropertyPath("Foreground"), Source = at, Mode = BindingMode.TwoWay
                    });
                    _tb.SetBinding(TextBlock.TextProperty, new Binding {
                        Path = new PropertyPath("Text"), Source = this, Mode = BindingMode.TwoWay
                    });
                    at.TooltipContent      = _tb;
                    _apUserToolTip.Content = at;
                }
            }
        }
        private void CreatePopupEx()
        {
            if (_apErrorToolTip.IsNull())
            {
                _apErrorToolTip = new ToolTip();
                _apErrorToolTip.BorderThickness = new Thickness(0);
                _apErrorToolTip.Background      = new SolidColorBrush(Colors.Transparent);
                _apErrorToolTip.Padding         = new Thickness(0);

                _apErrorToolTip.Placement                = PlacementMode.Right;
                _apErrorToolTip.Padding                  = new Thickness(0, 0, 0, 10);
                _apErrorToolTip.HorizontalOffset         = 0;
                _apErrorToolTip.VerticalOffset           = 0;
                _apErrorToolTip.Opened                  += popup_Opened;
                _apErrorToolTip.PlacementTarget          = this;
                _apErrorToolTip.VerticalContentAlignment = VerticalAlignment.Center;

                if (at.IsNull())
                {
                    at = new AyTooltip();

                    Binding _at1 = new Binding {
                        Path = new PropertyPath("AyToolTipForeground"), Source = this, Mode = BindingMode.TwoWay
                    };
                    Binding _at2 = new Binding {
                        Path = new PropertyPath("AyToolTipBackground"), Source = this, Mode = BindingMode.TwoWay
                    };
                    Binding _at3 = new Binding {
                        Path = new PropertyPath("AyToolTipBorderBrush"), Source = this, Mode = BindingMode.TwoWay
                    };
                    at.SetBinding(AyTooltip.BorderBrushProperty, _at3);
                    at.SetBinding(AyTooltip.ForegroundProperty, _at1);
                    at.SetBinding(AyTooltip.BackgroundProperty, _at2);
                    at.Placement = Dock.Left;

                    _apErrorToolTip.Content = at;
                }
            }
        }