Hi, I want to change the text that appears in DataGridBooleanColumn . I don't want to display True or False but something else like Yes, No, Oui, Non etc.
Also is there any way to change an int field like having binding an Id from another table but wanting to display the name?
Thanks,
Stavros
2 Answers, 1 is accepted
0
Accepted
Lance | Manager Technical Support
Telerik team
answered on 29 May 2018, 05:32 PM
Hi Stavros,
You can accomplish this by using a DataGridTemplateColumn instead of a BooleanColumn. In the DataTemplate, use a Label to display the text. Bind that Label's Text property to the model's boolean property and use a converter to return the exact text you want to display.
public class MyBoolToStringConverter : IValueConverter
{
public void Convert(object value, ....)
{
return (bool)value ? "Oui" : "Non";
}
....
}
Note that the code above was abbreviated so that I could focus on the logic pertaining to changing the display text. If you're not familiar with IValueConverter, here's a tutorial from Xamarin that explains how they work with the rest of the required code.
Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items