This is a migrated thread and some comments may be shown as answers.

[Solved] Boolean Column showing Yes / NO

4 Answers 247 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jimmy
Top achievements
Rank 1
Jimmy asked on 21 Jul 2010, 10:13 PM
My users want to see a Yes or No instead of the check boxes on the Grid when a boolean column is shown.  I attempted to create a converter for the column to return "Yes" or "No" but nothing shows up in the column.  When I click on the Filters it shows Yes and No in the list of values that I can check.

 

 

 

<Telerik:GridViewDataColumn Header="Forecast?" DataMemberBinding="{Binding Model.HasForecast, Converter={StaticResource BoolConverter}}" IsReadOnly="True" TextAlignment="Center"/>



 

 

 

4 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 12:31 PM
Hi Jimmy,

 You need to set the DataType of the column to string for this to work. Because the backing property is a boolean, the GridViewDataColumn tries to create a Checkbox control, which then fails when the converter returns a string.

Kind regards,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Jimmy
Top achievements
Rank 1
answered on 22 Jul 2010, 02:34 PM
So how to set the data type. I have searched and found a couple of blogs with DataType="{x:Null}", but that doesnt solve the problem.

Attempted DataType="{x:String}"  and DataType="{x:string}"  but x does not contain those.

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 



Did find one suggestion DataType="{x:Type sys:String}" but that give me an error that Type doesnt exist in x.
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 02:44 PM
Hi Jimmy,

 Setting a type from XAML is pretty tricky in Silverlight. You need to do it from code-behind, I'm afraid. See attached sample application.

Greetings,
Yavor Georgiev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Carlos
Top achievements
Rank 1
answered on 07 Oct 2010, 10:34 PM
It would be nice if you guys added TypeConverter support so that you could convert from a string to a type...
Tags
GridView
Asked by
Jimmy
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Jimmy
Top achievements
Rank 1
Carlos
Top achievements
Rank 1
Share this question
or