示例#1
0
        /// <summary>
        /// PropertyChanged callback for a property that affects the selection or caret rendering.
        /// </summary>
        private static void UpdateCaretElement(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PasswordBox passwordBox = (PasswordBox)d;

            if (passwordBox.Selection != null)
            {
                CaretElement caretElement = passwordBox.Selection.CaretElement;
                if (caretElement != null)
                {
                    if (e.Property == CaretBrushProperty)
                    {
                        caretElement.UpdateCaretBrush(TextSelection.GetCaretBrush(passwordBox.Selection.TextEditor));
                    }

                    caretElement.InvalidateVisual();
                }

                // DDVSO:405199
                // If the TextBox is rendering its own selection we need to invalidate arrange here
                // in order to ensure the selection is updated.
                var textBoxView = passwordBox?.RenderScope as TextBoxView;

                if ((textBoxView as ITextView)?.RendersOwnSelection == true)
                {
                    textBoxView.InvalidateArrange();
                }
            }
        }
示例#2
0
        /// <summary>
        /// PropertyChanged callback for a property that affects the selection or caret rendering.
        /// </summary>
        private static void UpdateCaretElement(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PasswordBox passwordBox = (PasswordBox)d;

            if (passwordBox.Selection != null)
            {
                CaretElement caretElement = passwordBox.Selection.CaretElement;
                if (caretElement != null)
                {
                    if (e.Property == CaretBrushProperty)
                    {
                        caretElement.UpdateCaretBrush(TextSelection.GetCaretBrush(passwordBox.Selection.TextEditor));
                    }

                    caretElement.InvalidateVisual();
                }
            }
        }
示例#3
0
        // Token: 0x06005361 RID: 21345 RVA: 0x00172D08 File Offset: 0x00170F08
        private static void UpdateCaretElement(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PasswordBox passwordBox = (PasswordBox)d;

            if (passwordBox.Selection != null)
            {
                CaretElement caretElement = passwordBox.Selection.CaretElement;
                if (caretElement != null)
                {
                    if (e.Property == PasswordBox.CaretBrushProperty)
                    {
                        caretElement.UpdateCaretBrush(TextSelection.GetCaretBrush(passwordBox.Selection.TextEditor));
                    }
                    caretElement.InvalidateVisual();
                }
                TextBoxView textBoxView  = ((passwordBox != null) ? passwordBox.RenderScope : null) as TextBoxView;
                TextBoxView textBoxView2 = textBoxView;
                if (textBoxView2 != null && ((ITextView)textBoxView2).RendersOwnSelection)
                {
                    textBoxView.InvalidateArrange();
                }
            }
        }