I'm trying to change the background color of the grid named LayoutRoot to black when you click the button bgButton in the application bar. I can't find anything on how to do this through Google or anything.
Thanks.
In the event handler for the button's Click event add the following:
LayoutRoot.Background = new SolidColorBrush( Colors.Cyan ); It doesn't have to be a SolidColorBrush, it can be any class derived from Brush, such as LinearGradientBrush, RadialGradientBrush etc.
You can also use a binding instead of explicitly setting the color for the Grid.
In XAML
<Grid Background="{Binding RootBackground}"> ... </Grid> In your ViewModel
public Brush RootBackground { get { return _rootBackground; } set { if( value != _rootBackground ) { _rootBackground = value; NotifyPropertyChanged( "RootBackground" ); } } } private Brush _rootBackground = new SolidColorBrush( Colors.Transparent ); In the button event handler
RootBackground = new SolidColorBrush( Colors.Cyan );