2
給定一個Settings.settings
文件,其中包含一個或多個SolidColorBrush
條目,其中包含Application
作用域,如何將這些值綁定到XAML樣式模板?基於SolidColorBrush的綁定設置直接在XAML中
舉例來說,我有一個名爲SolidColorBrush
與MyAppColor
作爲#FF0091D2
價值和自定義Button
風格模板,在這裏我想Background
從MyAppColor
有顏色。我怎樣才能做到這一點?
我已經嘗試添加namespace (?)
到XAML文件,就像這樣:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:namespace.Properties"
然後試圖用properties
這樣的:
Background="{x:Static properties:Settings.Default.MyAppColor}"
但它說它不能嵌套類型。