入力文字列を受け取り、 ":"を追加するコンバータを作成できます。
public class AddStringToStringConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string input = value as string;
string suffix = parameter as string;
return input + suffix;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
XAML:
<Window.Resources>
<local:AddStringToStringConverter x:Key="AddStringToStringConverter"/>
</Window.Resources>
...
<Label Text="{Binding Source={x:Static resx:Resource.Form_OtherOption_Description}, Converter={StaticResource AddStringToStringConverter}, ConverterParameter=:}"/>
またはそのような何か。それを試して、少なくとも私のソースのために働いた。
あなたに空白などがある場合は、ConverterParameter
をsignle引用符を使用して削除できないようにすることができます。
編集:ええ...右ああ...私は前に必要なことがないStringFormat
もあります、ehehehe ...
3.5の場合は、@ H.B.の解決策を使用する必要があります。 – user7116