【发布时间】:2018-01-03 13:12:49
【问题描述】:
给定一个Settings.settings 文件,其中包含一个或多个SolidColorBrush 条目和Application 范围,我如何将这些值绑定到XAML 样式模板?
例如,我将有一个名为MyAppColor 的SolidColorBrush 以#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}"
但它说它不能有嵌套类型。
【问题讨论】: