9 Answers, 1 is accepted
Cell selection is not sported in the version that you have downloaded. Cell selection will be introduced with our upcoming Q2 release. Unfortunately columns selection will not be supported out of the box probably until the first service pack of Q2.
Still, column selection will be possible with a bit of customization.
Kind regards,
Milan
the Telerik team
I can trace the click on the header of a column, but unable to select the cells as the grid is binded to a datacontext and the rows are shown as of that data context. As you mentioned this can be done with a bit of customization. Could you please help me to send me any sample code for this task?
Regards
Ashish
Unfortunately I will not be able to send you a sample code since the functionality that I am about to talk about is not available in our beta releases .
With Q2 the SelectedCells collection will have a method called AddRange which will allow you to select a range of cells. When a header is clicked you will be able to call AddRange to select all cells of the respective column.
For the time being this is the only information that I can share.
Greetings,
Milan
the Telerik team
I am also looking for the same functionality.
I have a latest build Q2 2010.
However SelectedCells collection does not have a method called AddRange.
Could you please send a sample project, how to customize it?
Thanks,
Pinak Desai
Unfortunately, due to higher-priority issues, exposing the AddRange method has been postponed. However, you can easily select all the cells in a column like so:
foreach
(var item
in
this
.gridView.Items)
{
var cellInfo =
new
GridViewCellInfo(item,
this
.gridView.Columns[3],
this
.gridView);
this
.gridView.SelectedCells.Add(cellInfo);
}
Yavor Georgiev
the Telerik team
Could you also please send me a code snippet, how can I inject a button / image into HeaderRow and how can I validate which button has been clicked?
I have a grid with 50 columns and AutoGenerateColumns="true".
Now I want to give users an ability to select the cell of perticular column on header selection without affecting sort functionality.
so I am thinking to provide button or image. what you suggest?
You can set the Header property of a GridViewColumn to a UIElement, such as a button, and it'll show up in the header.
Sincerely yours,Yavor Georgiev
the Telerik team
I didn't get your solution.
I want both button and HeaderText inside the Header, and I don't want to write like following code inside my xaml otherwise I have to repeat it for as many columns I have. As I said earlier I have autogeneratedcolumns set to true.
<telerikGrid:GridViewDataColumn.Header>
<StackPanel>
<TextBlock Text="Full Name"/>
<Button x:Name="ColumnSelector" Height="20" Click="ColumnSelector_Click"></Button>
</StackPanel>
</telerikGrid:GridViewDataColumn.Header>
Check out the attached project. It modifies the template of GridViewHeaderCell to add a new button, which toggles selection of the cells in the column.
All the best,Yavor Georgiev
the Telerik team