<Grid x:Name="LayoutRoot" Background="#93c9cc"> <Rectangle Width="640" Height="480" Stroke="Gainsboro" StrokeThickness="2" RadiusX="10" RadiusY="10"> <Rectangle.Fill> <ImageBrush x:Name="imgBack" ImageSource="/Images/bg_back.jpg" Opacity="0.6"> </ImageBrush> </Rectangle.Fill> </Rectangle> </Grid> 如何在后台中更改页面的颜色及背景图片呢?参考下面的代码? imgBack.ImageSource = new BitmapImage(new Uri("Images/a.jpg", UriKind.Relative)); LayoutRoot.Background = new SolidColorBrush(Colors.Brown); 可以更改颜色代码如下: Color c = new Color(); c.A = 255; c.R = 0; c.G = 0; c.B = 0; SolidColorBrush brush = new SolidColorBrush(c); Color c = Colors.Black; SolidColorBrush brush = new SolidColorBrush(c); Color c = SystemColors.ControlColor; SolidColorBrush brush = new SolidColorBrush(c); Color c = Color.FromArgb(255, 255, 255, 255); SolidColorBrush brush = new SolidColorBrush(c);