Hello, We're trying to implement a custom formatting bar for a radrichtextbox and are having some issues with a specific command.
We are tracking the state of the users selected text by adding eventhandlers to the different commands of the radrichtextbox and all is working well, except in one case: The ChangeListStyleCommand. For some reason it seems as if the "ListStyleChangedChanged"-event is not being called when a user selects a segment of text contained (partially or completely) in a list (including an attached image to show what I mean).
I might have a wrong understanding of how it's supposed to work, but the other commands seem to work in such fashion.
Relevant C# Code:
using
System.Windows;
using
System.Windows.Controls;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Documents.Lists;
using
Telerik.Windows.Documents.Model;
using
Telerik.Windows.Documents.RichTextBoxCommands;
namespace
...
{
public
partial
class
DescriptionEditor : UserControl
{
public
DescriptionEditor()
{
InitializeComponent();
...
InitializeEventsForTextboxes(PublicDescriptionEditor);
}
...
private
void
InitializeEventsForTextboxes(
params
RadRichTextBox[] textboxes)
{
if
(textboxes !=
null
)
{
foreach
(var textbox
in
textboxes)
{
...
// This is performed for the specific textbox.
// We know this since other commands are working
textbox.Commands.ChangeListStyleCommand.ListStyleChangedChanged += ListStyle_Changed;
...
}
}
}
private
void
ListStyle_Changed(
object
sender, StylePropertyChangedEventArgs<ListStyle> e)
{
// This never gets called
...
}
}
}
Relevant XAML code:
<UserControl x:Class=
"... DescriptionEditor"
xmlns:telerik=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Name=
"PersonDescriptionEditor"
>
...
<telerik:RadRichTextBox
x:Name=
"PublicDescriptionEditor"
IsSelectionMiniToolBarEnabled=
"False"
Grid.Row=
"1"
/>
<telerik:HtmlDataProvider
Html=
"{Binding Path=DataContext, ElementName=PersonDescriptionEditor, Mode=TwoWay}"
RichTextBox=
"{Binding ElementName=PublicDescriptionEditor}"
>
<telerik:HtmlDataProvider.FormatProvider>
<telerik:HtmlFormatProvider>
<telerik:HtmlFormatProvider.ExportSettings>
<telerik:HtmlExportSettings
DocumentExportLevel=
"Fragment"
StylesExportMode=
"Inline"
StyleRepositoryExportMode=
"DontExportStyles"
/>
</telerik:HtmlFormatProvider.ExportSettings>
</telerik:HtmlFormatProvider>
</telerik:HtmlDataProvider.FormatProvider>
</telerik:HtmlDataProvider>
...
</UserControl>
Not really sure what you need to see, but the above code should contain all relevant parts