I have a column when I bind enum:
<telerik:GridViewComboBoxColumn Header="N/U" DataMemberBinding="{Binding VehicleCondition}" ItemsSourceBinding="{Binding Source={StaticResource Locator}, Path=CarSalon.VehicleConditions}" IsGroupable="False" DataFormatString="" />
How can I display only first letter by DataFormatString?
Or maybe another solution without DataFormatString?
In this case you want to implement a
ValueConverterwhich will look something like this (using LINQ string extensions):Obviously if your input value (
VehicleCondition) isn’t a string you’ll need to do something more complicated.Your XAML will become something like this:
If you need to access other information about the item not just the
VehicleConditionthen you can change the binding to:which will bind to the object. Your converter then becomes something like:
where you can do any checks on the object or get other properties of the object you need.