简体   繁体   English

在WPF中查看其他文本的文本

[英]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 which 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? 但是我该怎么做?

建议

将2个TextBoxTextBlock放在另一个的顶部,并使顶部的背景透明。

one simple solution is to put 2 textblocks in a grid and make the background of the top one transparent. 一个简单的解决方案是将2个文本块放在网格中,并使顶部的背景透明。

 <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>

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM