Can't set the LayoutMode in a style

3 posts, 0 answers
  1. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 17 Jan 2013 Link to this post

    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. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 17 Jan 2013 Link to this post

    Hello,
    same problem with the IsSpellCheckingEnabled dependency property.
    Patrick
  3. DevCraft banner
  4. Vasil
    Admin
    Vasil avatar
    124 posts

    Posted 22 Jan 2013 Link to this post

    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.

Back to Top