TextBlock Brush Gives Incorrect Color

I have TextBlock and Rectangle, both are sitting in an empty WPF4 window. Front Panel TextBlock and Rectangle Fill are set to SolidColorBrush with a value of # 80800000.

It looks like this:

enter image description here

The correct color is the rectangle (50% transparent burgundy), but TextBlock gives an even gray color. What's happening?

EDIT: Here's the XAML:

<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBlock Foreground="#80800000" Height="100" HorizontalAlignment="Left" Margin="47,39,0,0" Text="TextBlock" VerticalAlignment="Top" Width="266" FontFamily="Arial" FontWeight="Bold" FontSize="56" /> <Rectangle Fill="#80800000" Height="100" HorizontalAlignment="Left" Margin="71,174,0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="200" /> </Grid> </Window> 
+6
source share
1 answer

How to do this with any additional icons that you have at the top of the window? This code is as expected for me.

screenshot

or is there any additional opacity in your code?

0
source

Source: https://habr.com/ru/post/892198/


All Articles