Reputation: 61
I want to change Page's Background Color from Code Behind. But I don't know how to do this.
Please tell me how to write Code about changing Background Color.
I use Visual Studio 2015 C# XAML enviroment.
Upvotes: 0
Views: 627
Reputation: 10627
To set the page's background color in code behind, we should get the page object from xaml. So add x:Name property for the page and set the background color from code behind.
XAML Code
<Page ... x:Name="thispage">
Code Behind
SolidColorBrush redbrush=new SolidColorBrush(Colors.Red);//your color
thispage.Background = redbrush;
Upvotes: 3