Пример #1
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;
                }
            }
        }
        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;
                }
            }
        }