读书人

怎么在后台修改gird的背景

发布时间: 2013-03-04 17:22:12 作者: rapoo

如何在后台修改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)) };

BitmapImage需要引用命名空间

读书人网 >Windows Mobile

热点推荐