0
我想将样式应用于WPF中的控件。并且已经注意到后面的代码中可用的一些属性在XAML中不可用?为什么我不能访问WPF控件的一些属性?
这是为什么?
你可以帮我下面的例子:
<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>
当试图在页宽应用于控制的文件,我得到一个例外,它是无法访问?
谢谢。
您能否更详细地解释一下文章或示例?对不起,不知道wpf。 – shenku 2012-02-28 03:09:22
@shenku:在相关的[我的问题](http://stackoverflow.com/questions/4577131/is-there-a-way-to-use-a-style-setter-for-properties-of-properties )大部分应该被覆盖。另请阅读[文档](http://msdn.microsoft.com/zh-cn/library/system.windows.setter.property.aspx)。 – 2012-02-28 03:10:16