Approved
Last Updated: 31 Oct 2018 07:54 by ADMIN
ADMIN
Boby
Created on: 29 Jun 2017 08:33
Category: RichTextBox
Type: Feature Request
2
RichTextBox: Provide functionality for getting attributes of the selection using UIA (automation peer)
Current implementation of Text UI automation pattern doesn't support obtaining the attributes of the selection, e.g. bold, italic, etc.

The API allows returning custom ITextRangeProvider where the behavior could be implemented , but this requires a lot of work. 

If this is built-in, the API will allow getting the attributes as follows:

            var automationPeer = (RadRichTextBoxAutomationPeer)FrameworkElementAutomationPeer.FromElement(this.radRichTextBox);
            TextPattern textPattern = (TextPattern)automationPeer.GetPattern(PatternInterface.Text);

            object isItalic = textPattern.GetSelection()[0].GetAttributeValue(TextPattern.IsItalicAttribute);
            if (isItalic == TextPattern.MixedAttributeValue)
            {
                // mixed
            }
            else
            {
                bool italic = (bool)isItalic;
            }

Currently, AutomationElement.NotSupported is always returned.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments