文本框或RichTextbox格式 [英] Textbox or RichTextbox Formatting
问题描述
我正在添加一个文本框来涵盖里程和价值交易,我希望将文本格式化为分别显示40,348和$ 1250.00。我可以通过VS做到这一点,但我希望在我的xaml代码中进行这种类型的文本格式化。这可能吗?
谢谢你Chris
你应该能够(.net 3.5 sp1)执行以下操作
< TextBox Text < span style ="font-family:Consolas; color:blue"> = " {Binding Path = Double, StringFormat = F3 } " />
< TextBox Text = " {Binding Path = Double,< span style ="background:yellow"> StringFormat =金额:{0:C}} " / >
< TextBox 文字 = " {Binding Path = Double, StringFormat = Amount: \\ {0:C \}} " />
< TextBox >
< TextBox.Text >
< Binding Path = " Double " StringFormat = " { } {0:C} " />
< p class = MsoNormal style ="line-height:normal; margin:0in 0in 0pt"> < / TextBox.Text >
< / T extBox >
更多详情 seach for"wpf stringformat xaml"
I am adding a text box to cover Mileage and Trade-in-value, I wish to format the text to display 40,348 and $1250.00 respectively. I can do this through VS but I wish to do this type of text formatting in my xaml code. Is this possible?
Thank You
Chris
You should be able (.net 3.5 sp1) to do the following
<TextBox Text="{Binding Path=Double, StringFormat=F3}"/>
<TextBox Text="{Binding Path=Double, StringFormat=Amount: {0:C}}"/>
<TextBox Text="{Binding Path=Double, StringFormat=Amount: \{0:C\}}"/>
<TextBox>
<TextBox.Text>
<Binding Path="Double" StringFormat="{}{0:C}"/>
</TextBox.Text>
</TextBox>
for more details seach for "wpf stringformat xaml"
这篇关于文本框或RichTextbox格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!