コード例 #1
0
        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;
                }
            }
        }
コード例 #2
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;
                }
            }
        }
コード例 #3
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;
                }
            }
        }
コード例 #4
0
        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;
                }
            }
        }