Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C#代码:
一个Theme有成员的类Color themeColorAnd
Theme
Color themeColor
MainWindow有一个成员Theme winTheme。
MainWindow
Theme winTheme
XAML:
一个Grid。
Grid
我想将 绑定winTheme.themeColor到 Grid 的Background. 这样当变量改变时,Grid的背景会自动改变......
winTheme.themeColor
Background
我怎样才能做到这一点?
<Grid> <Grid.Background> <SolidColorBrush Color="{Binding Color}"/> </Grid.Background> </Grid>