【发布时间】:2012-02-28 02:55:28
【问题描述】:
我正在尝试将样式应用于 WPF 中的控件。并且注意到某些在代码隐藏中可用的属性在 XAML 中不可用?
这是为什么?
你能帮我举个例子吗:
<Style TargetType="RichTextBox">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"></Setter>
<Setter Property="Background" Value="WhiteSmoke"></Setter>
<Setter Property="Foreground" Value="#515151"></Setter>
<Setter Property="Document.PageWidth" Value="300"></Setter>
</Style>
当尝试将 PageWidth 应用到控件的 Document 时,我得到一个异常,它不可访问?
谢谢。
【问题讨论】: