开发者

WPF: How add check mark to the textblock?

开发者 https://www.devze.com 2023-01-15 00:19 出处:网络
I开发者_Python百科 am wondering if anyone knows the tag for check mark symbol. I need to have it in a texblock. I looked online for any clue and did not find anything that will work with XAML.

I开发者_Python百科 am wondering if anyone knows the tag for check mark symbol. I need to have it in a texblock. I looked online for any clue and did not find anything that will work with XAML. Thank you in advance.


You can use the SQUARE ROOT character in either in XAML or code-behind to achieve a check mark symbol:

XAML:

<StackPanel>
    <TextBlock Text="√"/>
    <TextBox Text="√"/>
    <Label Content="√"/>
</StackPanel>

Code-behind:

txtBoxName.Text = "\x221A";


just refer this document by Josh smith about Differences between Label and TextBlock

http://joshsmithonwpf.wordpress.com/2007/07/04/differences-between-label-and-textblock/

I think you can do by using Label

<Label>   
<StackPanel Orientation="Horizontal"> 
<Path 
                                Width="11" Height="11" 

                                SnapsToDevicePixels="False" 
                                Stroke="red"
                                StrokeThickness="2"
                                Data="M 2,4 C 2,4 3,5 5,13 C 5,13 5,3 12,0" />
                                <TextBlock Margin="5,0,0,0">Successfully Completed!</TextBlock>
                                </StackPanel>
                                </Label>
</StackPanel>


<StackPanel Orientation="Horizontal">
   <TextBlock Text="&#xE10B;" FontFamily="Segoe MDL2 Assets" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40"/>
   <Border Width="10"/>
   <TextBlock Text="Checkmark!" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40"/>
</StackPanel>
0

精彩评论

暂无评论...
验证码 换一张
取 消