I am wondering if it is possible to set the background of my StackPanel to the Windows Phone 7 user selected accent (theme) color. I have heard that you are supposed to use styles so it can be used for all the StackPanels on the current xaml page. However I am a bit lost.
Example of my current static background color:
<StackPanel Width="400" Background="#FF1BA1E2" Margin="0, 10, 0, 0" Tag="ABC">
<TextBlock Text="ABC" FontSize="50" Margin="10" />
</StackPanel>
Thanks for the help in advance.
PS: Just in case anyone is wondering the hexadecimal value "#FF1BA1E2" is the color of the default WP7 blue accent (theme).
Use the built in static resources to automatically get the theme color:
Background="{StaticResource PhoneAccentBrush}"
i have encountered the same exception while trying this.
just try Apply Binding to the Background
through Properties tab.
or hardcode this into the xaml file, to the stackpanel element
Background="{Binding Source={StaticResource PhoneAccentBrush}}"
it solves the exception. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With