This is a migrated thread and some comments may be shown as answers.
Can't set the LayoutMode in a style
2 Answers 9 Views
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Patrick asked on 17 Jan 2013, 04:48 PM
Hello,
when trying to set the LayoutMode dependency property of a RadRichTextBox using a style, the application crashes.

Test case:
1. Create a new Silverlight application.
2. Replace MainPage.xaml with:
<UserControl
  x:Class="SilverlightApplication2.MainPage"
  mc:Ignorable="d"
  d:DesignHeight="300" d:DesignWidth="400">
 
  <Grid x:Name="LayoutRoot" Background="White" Margin="5">
 
    <Grid.Resources>
      <Style TargetType="tk:RadRichTextBox">
        <Setter Property="LayoutMode" Value="Flow" />
      </Style>
    </Grid.Resources>
 
    <tk:RadRichTextBox />
     
  </Grid>
</UserControl>

3. Run

If you comment the style definition, the application runs correctly.

Patrick

2 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 2
Iron
answered on 17 Jan 2013, 04:53 PM
Hello,
same problem with the IsSpellCheckingEnabled dependency property.
Patrick
0
Vasil
Telerik team
answered on 22 Jan 2013, 02:17 PM
Hello Patrick,

Thank you for your question.

LayoutMode is a nullable property (of type DocumentLayoutMode?) and for some reason it cannot be set through a style using the "normal" syntax, even though it usually shows in the designer.

However, you can set it like this:

<Style TargetType="telerik:RadRichTextBox">
    <Setter Property="LayoutMode">
        <Setter.Value>
            <telerik:DocumentLayoutMode>Flow</telerik:DocumentLayoutMode>
        </Setter.Value>
    </Setter>
    <Setter Property="IsSpellCheckingEnabled" Value="False"/>
</Style>

We didn't observe any issues with the property IsSpellCheckingEnabled. I hope this helps!

All the best,
Vasil
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Asked by
Patrick
Top achievements
Rank 2
Iron
Answers by
Patrick
Top achievements
Rank 2
Iron
Vasil
Telerik team
Share this question
or