
Triet Nguyen Cong
Top achievements
Rank 2
Triet Nguyen Cong
asked on 22 Aug 2010, 08:44 AM
Hi Telerik team,
Due to our business, we have to build a grid view using AutoGenerateColumns="True".In this grid, we place a check box. But to tick it, we have to click 3 times (attached file):
- First time, active cell
- Second time, active check box.
- Third time, tick on check box.
Question is: How can we build a grid which tick check box only one time? And below is our code
MainPage.xaml
MainPage.xaml.cs
Thanks,
Due to our business, we have to build a grid view using AutoGenerateColumns="True".In this grid, we place a check box. But to tick it, we have to click 3 times (attached file):
- First time, active cell
- Second time, active check box.
- Third time, tick on check box.
Question is: How can we build a grid which tick check box only one time? And below is our code
MainPage.xaml
<
UserControl
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"SilverlightApplication7.MainPage"
xmlns:Controls
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Controls:RadGridView
x:Name
=
"grTest"
AutoGenerateColumns
=
"True"
></
Controls:RadGridView
>
</
Grid
>
</
UserControl
>
MainPage.xaml.cs
using
System.Collections.Generic;
using
System.Windows.Controls;
namespace
SilverlightApplication7
{
public
partial
class
MainPage
{
public
MainPage()
{
InitializeComponent();
var persons =
new
List<Person> {
new
Person(
"Davide Seaman"
,
true
),
new
Person(
"Roberto Baggio"
,
false
)};
grTest.ItemsSource = persons;
}
}
public
class
Person
{
public
string
Name {
get
;
set
; }
public
bool
IsMarried {
get
;
set
; }
public
Person(
string
name,
bool
isMarried)
{
Name = name;
IsMarried = isMarried;
}
}
}
Thanks,
8 Answers, 1 is accepted
0
Hi Triet Nguyen Cong,
You can set the EditTriggers property of the gridview to "CellClick". This way - clicking the cell only once will go in edit mode.
Let me know if this helps.
Greetings,
Veselin Vasilev
the Telerik team
You can set the EditTriggers property of the gridview to "CellClick". This way - clicking the cell only once will go in edit mode.
Let me know if this helps.
Greetings,
Veselin Vasilev
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

Triet Nguyen Cong
Top achievements
Rank 2
answered on 23 Aug 2010, 11:20 AM
Hi Veselin Vasilev,
By using EditTriggers property, we only can reduce 1 time click. That means, to tick a check box, we still have 2 steps:
- The first click go to edit mode
- The second click tick to check box.
Is there any property which we can set to tick to check box with only one click?
Thanks!
By using EditTriggers property, we only can reduce 1 time click. That means, to tick a check box, we still have 2 steps:
- The first click go to edit mode
- The second click tick to check box.
Is there any property which we can set to tick to check box with only one click?
Thanks!
0
Hi Triet Nguyen Cong,
There is no such property. What you can do is to define your own cell template and put a checkbox there.
This way you should be able to check/uncheck with only one click. The downside is that you need to subscribe to the Click event of the checkbox to update the underlying property of your business object.
Hope this helps.
Best wishes,
Veselin Vasilev
the Telerik team
There is no such property. What you can do is to define your own cell template and put a checkbox there.
This way you should be able to check/uncheck with only one click. The downside is that you need to subscribe to the Click event of the checkbox to update the underlying property of your business object.
<
telerik:GridViewColumn
Header
=
"IsActive"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
CheckBox
IsChecked
=
"{Binding IsActive}"
Click
=
"CheckBox_Click"
></
CheckBox
>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
Hope this helps.
Best wishes,
Veselin Vasilev
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

Triet Nguyen Cong
Top achievements
Rank 2
answered on 24 Aug 2010, 08:08 AM
Hi Veselin Vasilev,
As we mentioned in the first post, we are building a grid with dynamic columns, so we have to use "AutoGeneratedColumns = True" property. This grid is a check box matrix allow user choose. So, we don't think we can use CellTemplate to fix this problem.
Anyway, thanks for your support!
Triet
As we mentioned in the first post, we are building a grid with dynamic columns, so we have to use "AutoGeneratedColumns = True" property. This grid is a check box matrix allow user choose. So, we don't think we can use CellTemplate to fix this problem.
Anyway, thanks for your support!
Triet
0
Hi Triet Nguyen Cong,
In this case you can define the DataTemplate as a resource and set the CellTemplate in the AutoGeneratingColumn event of the gridview:
This way you will still have the columns autogenerated.
Kind regards,
Veselin Vasilev
the Telerik team
In this case you can define the DataTemplate as a resource and set the CellTemplate in the AutoGeneratingColumn event of the gridview:
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"boolDataTemplate"
>
<
CheckBox
IsChecked
=
"{Binding IsActive}"
Click
=
"CheckBox_Click"
></
CheckBox
>
</
DataTemplate
>
</
UserControl.Resources
>
<
telerik:RadGridView
ItemsSource
=
"{Binding Clubs}"
AutoGeneratingColumn
=
"RadGridView_AutoGeneratingColumn"
/>
private
void
RadGridView_AutoGeneratingColumn(
object
sender, GridViewAutoGeneratingColumnEventArgs e)
{
if
(e.Column.UniqueName ==
"IsActive"
)
{
e.Column.CellTemplate =
this
.Resources[
"boolDataTemplate"
]
as
DataTemplate;
}
}
This way you will still have the columns autogenerated.
Kind regards,
Veselin Vasilev
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

Valentin Raceanu
Top achievements
Rank 1
answered on 04 Feb 2011, 04:21 PM
Looks like there is a simpler solution now than defining a custom cell: http://www.telerik.com/help/wpf/gridview-checkbox-column.html
0

Alfons
Top achievements
Rank 2
answered on 08 Nov 2012, 02:31 PM
Thanks Valentin, for the tip.
But is it also possible to set AutoSelectOnEdit="True" when AutoGenerateColumns="True"?
But is it also possible to set AutoSelectOnEdit="True" when AutoGenerateColumns="True"?
0
Hello Alfons,
Yoan
the Telerik team
Indeed, it is possible. Please check this help article, which describes the approach.
Don't hesitate to contact us if you have other questions.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.