0
我想樣式擴展WPF工具包RichTextBox的,像這樣:擴展WPF工具包 - 與FormatBar樣式化的RichTextBox導致異常
<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>
然而,在運行時,它失敗,出現ArgumentNullException說:「值不能爲空。參數名稱:屬性「。
什麼可能導致此行爲?
編輯1 我也試過這個語法:
<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>
不幸的是它給了我同樣的異常。
感謝您的輸入。不幸的是問題依然存在 – Farawin