I have implemented a control that allows you to change several properties of selected text that looks like this.
My issue is when users select some text I need to know what font the selection is, and in cases where the selection is more than one font I need to know that as well so I don't set the combobox to any value. The same is true for the font size, color, bold,italics, alignment, ect. Can you please give me a description on how to read these values from selected text?
Thank you for your post. I have been looking into the question that you are having and you can use the GetCommonCharacterSettings method of the RichTextDocument. The method accepts a DocumentSpan as parameter and returns a CharacterSettings object, which has the common settings for the part of the document in the span. You can pass the DocumentSpan of the selection to this method and you can get the common settings for the selection. If the selection includes text with different settings, the CharacterSettings object returned by GetCommonCharacterSettings method will have null for the settings that have different values. You can read more details on the GetCommonCharacterSettings method here: http://help.infragistics.com/Doc/WPF/current/CLR4.0/?page=InfragisticsWPF4.Documents.RichTextDocument.v14.2~Infragistics.Documents.RichText.RichTextDocument~GetCommonCharacterSettings.html
Also, you can get all the RunNodes that are included in the selection and see the CharacterSettings for each of the nodes and compare the settings that you wish. I have created a sample application for you, that shows how you can implement both of the approaches.
Please let me know if I can assist you with anything else.
Developer Support Supervisor - XAML
You can also refer to our IgWord showcase sample application, which has a RichTextEditorSelectionAdapter that gets the selection information (using GetCommonCharacterSettings, etc) and exposes it via properties. You can download the source code for the IgWord application from here: http://www.infragistics.com/samples/wpf/application-samples.