2015-06-16 57 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