簡體   English   中英

如何在Application.Resources中上標字符串

[英]How to superscript a string in Application.Resources

我已經知道如何在WPF中這樣做

<TextBlock HorizontalAlignment="Left" Margin="359,10,0,0" 
           TextWrapping="Wrap" VerticalAlignment="Top" Width="75">
    <Run>X</Run>
    <Run BaselineAlignment="Superscript" FontSize="8">4</Run>
</TextBlock>

這個答案 ,或在代碼中

string area;
area = "mm\xB2";
testTblock.Text = area;

但是如何在Application.Resources中做到這一點?

<Application.Resources>
<System:String x:Key="area">
     //what should be here?
</System:String>

這樣我就可以將其應用於DynamicResource

<TextBlock Text="{DynamicResource area}" />

在文本值中,使用十六進制值編碼:

<system:String x:Key="myValue">
    mm&#xB2;
</system:String>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM