【发布时间】:2016-08-08 03:12:25
【问题描述】:
您好,我有一个 xaml 应用程序,它在页面上的许多地方使用了一种特定颜色。我想以编程方式更改此颜色的值。我不想单独更新每个对象的颜色。我试过这个:
<Grid
Background="{Binding GalleryViewBrush, Mode=TwoWay}"
Grid.Row="0"
Grid.Column="0">
然后在代码隐藏中:
公共画笔 GalleryViewBrush { get;放; }
GalleryViewBrush = new SolidColorBrush(Colors.Red);
但颜色永远不会起作用。我也试过 xbind 但没有运气
谢谢
【问题讨论】:
-
并从绑定中删除
Mode=TwoWay。这没有任何意义。
标签: xaml binding solidcolorbrush