Accessing background color of textblock
If I remember right WinRT is based a lot on Silverlight, in whereas TextBlock
derives from FrameworkElement
and unlike in WPF, it doesn't have a Background
property of its own.
A workaround would be to just provide the same effect with an additional element to act as a container and provide your background using Border
or Grid
with Background
etc. Something like;
<Border Background="AntiqueWhite">
<TextBlock/>
</Border>
Or perhaps a Rectangle
behind the TextBlock
to provide the same thing if it's contained in say maybe a Grid
Cell or the likes unless you wanted to set sizes on the Rectangle
directly;
<Rectangle Fill="AntiqueWhite"/>
<TextBlock/>
Unfortunately I think this is your only current alternative. Hope this helps.
This sets the background to antique white. Furthermore the Height and width of the grid is bound to that of the TextBlock, so you don't have to manually set the size of the grid.
<Grid Background="AntiqueWhite" Height="{Binding ActualHeight , ElementName=textBlock1}" Width="{Binding ActualHeight , ElementName=textBlock1}">
<TextBlock x:Name="textBlock1" Text="Text" />
</Grid>
To set the Background Colour for the TextBlock
TextblockName.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF202B49"));