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

Want to display "Yes"/"No" in a column for Boolean value instead of checkbox in RadGridView for WPF

5 Answers 821 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
MSI
Top achievements
Rank 1
MSI asked on 23 Feb 2016, 05:48 PM

I would like to display "Yes" or "No" for a Boolean in RadGridView instead of a checkbox. I would like to implement this changes in xaml. Columns are generating dynamically. This is how it's created now:

 <telerik:RadGridView x:Name="Data" Grid.Row="3" Margin="5" AutoGenerateColumns="False" CanUserSortColumns="True" IsFilteringAllowed="True"
                                 grid:RadGridViewColumnsBinding.ColumnsCollection="{Binding Path=Columns}"
                                 IsReadOnly="False" CanUserResizeColumns="True"/>

 

I am new in Silverlight coding. Will really appreciate if someone can help.

5 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 25 Feb 2016, 04:44 PM
Hello,

I'm attaching a sample project based on your requirements. All I've done is added a BooleanToYesNo converter and set it as the Converter for the respective binding. Please have a look and let me know whether this works for you.

Regards,
Dilyan Traykov
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
0
MSI
Top achievements
Rank 1
answered on 03 Mar 2016, 12:11 AM
Thank you for the attached project. This was very helpful. On a different note, currently in the checkbox, when none of data there in backend it shows a blue sign in the checkbox. (for 1 it shows as checked, for 0 shows as unchecked/blank). Any idea how this blue sign could be setup or how to get rid of the blue signfrom the Checkbox?
0
Yoan
Telerik team
answered on 03 Mar 2016, 06:51 AM
Hi,

I am not sure that I can understand your question. May I ask you to share more details? An image would be helpful.

Regards,
Yoan
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
0
MSI
Top achievements
Rank 1
answered on 03 Mar 2016, 08:30 PM
In the image where it shows blank in checkbox for 'false' and checked for 'true'. Where no true false has been passed(the value is null), it shows this blue/purple sign in the checkbox. Want to get rid of it. Couldn't figure how it's implemented there.
0
Dilyan Traykov
Telerik team
answered on 07 Mar 2016, 03:45 PM
Hello,

The blue sign you're referring to is the undetermined state of the Tri-State CheckBox.
One way to get rid of it, if applicable, is to make the respective boolean property of your business object non-nullable so that a default value of false is set.

Your other option is to style the CheckBoxColumn, and more specifically - the IndeterminatePath of its Indeterminate visual state, to your liking.

I hope you find these suggestions helpful.

Regards,
Dilyan Traykov
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
Tags
General Discussions
Asked by
MSI
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
MSI
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or