0

I'm trying to style the Extended WPF Toolkit RichTextBox like so:

<Style TargetType="{x:Type tk:RichTextBox}">
    <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="SpellCheck.IsEnabled" Value="True"/>   
    <Setter Property="tk:RichTextBoxFormatBarManager.FormatBar" Value="{x:Type tk:RichTextBoxFormatBar}"/>
</Style>

However at runtime it fails with a ArgumentNullException saying: "Value cannot be null. Parameter name: property".

What could be causing this behaviour?

EDIT 1 I also tried this syntax:

<Style TargetType="{x:Type tk:RichTextBox}">
    <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="SpellCheck.IsEnabled" Value="True"/>
    <Setter Property="tk:RichTextBoxFormatBarManager.FormatBar">
        <Setter.Value>
            <tk:RichTextBoxFormatBar />
        </Setter.Value>
    </Setter>
</Style>

Unfortunately it gave me the same exception.

Farawin
  • 1,375
  • 2
  • 14
  • 19

1 Answers1

1

Value is expecting an instance not a Type. Please try

<Style TargetType="{x:Type tk:RichTextBox}">
    <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="SpellCheck.IsEnabled" Value="True" />   
    <Setter Property="tk:RichTextBoxFormatBarManager.FormatBar">
        <Setter.Value>
            <tk:RichTextBoxFormatBar />
        </Setter.Value>
    </Setter>
</Style>
LPL
  • 16,827
  • 6
  • 51
  • 95