2015-06-16 50 views
2

我使用AF ResourceDictionary中用于翻译WPF/XAML ResourceDictionary中有空格

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"> 

    <System:String x:Key="NumStartsTotal">Total: </System:String> 

</ResourceDictionary> 

我访问这样的:

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

我想输出为 “总计:”(与空白处),但它出来“总:”(没有空白处)。

这是故意的吗?我该如何改变它?

谢谢! - 让我知道你是否需要更多信息!

回答

2

您可以将xml:space="preserve"添加到您的资源中。就像它说的那样,这将保留空间。

<System:String xml:space="preserve" x:Key="NumStartsTotal">Total: </System:String> 

更多信息herehere