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