如何在后台修改gird的背景
假设前台有这么一个grid
如何在后台修改他的背景
<Grid x:Name="LayoutRootPivot">
<Grid.Background>
<ImageBrush Stretch="Fill" ImageSource="/Images/Background.jpg"/>
</Grid.Background>
[解决办法]
private void button1_Click(object sender, RoutedEventArgs e)
{
gridName.Background = new SolidColorBrush(Colors.Blue);
}
grid.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri("/Images/test.jpg", UriKind.Relative)) };