Вы можете использовать конвертер значений для возврата префикса строки:
class PrefixValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string s = value.ToString();
int prefixLength;
if (!int.TryParse(parameter.ToString(), out prefixLength) ||
s.Length <= prefixLength)
{
return s;
}
return s.Substring(0, prefixLength);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
И в XAML:
<Window.Resources>
...
<local:PrefixValueConverter x:Key="PrefixValueConverter"/>
</Window.Resources>
...
...{Binding Path=TheProperty, Converter={StaticResource PrefixValueConverter},
ConverterParameter=1}...