4 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
You can create custom column similar to this blog post.
Sincerely yours,Vlad
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
Kakone
Top achievements
Rank 1
answered on 16 Sep 2010, 03:08 PM
Hello,
I try to do a GridViewRadioButtonColumn like the blog post. So I did this :
Visually, it seems correct but the behavior is wrong. When I check the radiobutton on a row, I must set the DataItem property to false for the last checked row. I don't know how I can do this in this GridViewRadioButtonColumn. Any idea ?
Cordially,
Kakone
I try to do a GridViewRadioButtonColumn like the blog post. So I did this :
public class GridViewRadioButtonColumn : GridViewDataColumn{ public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem) { RadioButton radioButton = new RadioButton(); radioButton.Margin = new Thickness(3.0, 0.0, 3.0, 0.0); if (DataMemberBinding != null) { radioButton.SetBinding(RadioButton.IsCheckedProperty, DataMemberBinding); } return radioButton; } public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem) { RadioButton radioButton = cell.Content as RadioButton; if (radioButton == null) { radioButton = new RadioButton(); radioButton.Margin = new Thickness(3.0, 0.0, 3.0, 0.0); radioButton.IsEnabled = false; } if (DataMemberBinding != null) { radioButton.IsChecked = (bool?)GetCellContent(dataItem); } return radioButton; }}Visually, it seems correct but the behavior is wrong. When I check the radiobutton on a row, I must set the DataItem property to false for the last checked row. I don't know how I can do this in this GridViewRadioButtonColumn. Any idea ?
Cordially,
Kakone
0
Hello Kakone,
You need to go one step further in your application and handle the Checked event of the RadioButton in the CreateCellEditTemplate method. What you need to do is to ensure that the property of all other items except the selected on is set to "False".
I am sending you a sample project implementing the functionality you need.
Maya
the Telerik team
You need to go one step further in your application and handle the Checked event of the RadioButton in the CreateCellEditTemplate method. What you need to do is to ensure that the property of all other items except the selected on is set to "False".
I am sending you a sample project implementing the functionality you need.
Best wishes,
Maya
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
Kakone
Top achievements
Rank 1
answered on 21 Sep 2010, 04:41 PM
It's perfect.
Thanks a lot!
Thanks a lot!
