【发布时间】:2015-07-15 15:08:38
【问题描述】:
我在 WPF 中有一个文本框,我需要以 xxx-xxx-xxxx 格式显示文本。
<TextBox FontSize="30" Text="{Binding MyString,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" MaxLength="10"></TextBox>
MyString 只是将 TextBox 中的值设置为其他逻辑的属性。我可以在 XAML 本身中使用 StringFormat 吗?
【问题讨论】:
-
如果你只写
xxx怎么样?xxxx怎么样?xxxxxxx怎么样?它允许空格吗?这是如何解释的? -
xxx 只会这样。 xxxx 将是 xxx-x 并且 xxxxxxx 将是 xxx-xxx-x。它不允许空格
标签: c# wpf string xaml string-formatting