View text over other text in WPF
I am developing an on-screen keyboard where each key generates a sequence of three keystrokes to another application. Each button has a text description. But now clients want the function to be able to choose to see w开发者_JAVA技巧hich characters are sent. Then I want the chars to be displayed over the descriptive text so that it is still possible to imagine the text below, see my suggestion below. But how do I do that?
one simple solution is to put 2 textblocks in a grid and make the background of the top one transparent.
<Grid Background="White" Width="100" Height="100">
<TextBlock Text="sdjfkjkf jskljfkl s flksjlkfjslkfjsdlkfjlök fjösljfslkdöfjklsdjfls" TextWrapping="Wrap"
HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Padding="10,3" Text="ABc" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Background>
<RadialGradientBrush>
<GradientStop Color="#00EFEEEE" Offset="1"/>
<GradientStop Color="#B2EDC4C4" Offset="0.836"/>
</RadialGradientBrush>
</TextBlock.Background>
</TextBlock>
</Grid>
Place 2 TextBox
or TextBlock
one on top of the other, and make the background of the top one transparent.
精彩评论