<telerik:GridViewDataColumn DataMemberBinding="{Binding Others}" ColumnGroupName="ATTRIBUTES">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<CheckBox Content="{Binding Path=Others}" IsChecked="{Binding Path=IsSelected,Mode=TwoWay}" Height="16" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Top" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
I want the check box to appear only when I have data in that cell. How would I achieve this? Right now, I am getting just the CheckBox in the cells where there is no data to display.
I am attaching the screen shot of the current behavior. Any help is greatly appreciated.
8 Answers, 1 is accepted
You can use a CellTemplateSelector as described in this help article. When you do not have data, then you can return an empty template.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Is there a way I can do this with one TemplateSelector in my scenario? The difference between each column would be the property I need to check for each column in the RadGrid.
Please let me know if I am not clear.
You can use one CellTemplateSelector, but you will have to add additional logic in order to return the most appropriate template based on the column of the templated cell. When the TemplateSelector is applied, you should check what is the column and apply the templates for that column.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
SelectTemplate(object item, System.Windows.DependencyObject container) method item is the Object and from the container, could you please let me know how to identify which column this belongs to?
You can get the column (that contains the current Cell) using this code:
GridViewColumn column = ((Telerik.Windows.Controls.GridView.GridViewCellBase)(container)).Column;
Based on what the column is, you should return the template.
Greetings,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
When the data type is string or Float the value should be in text, if Data type is Boolean, value should be in Checkbox. When It is Enum, value should be a comboBox. Please find the attached "requirment.png" for more detail.
Please let me know, How do I achieve this ?
*I am using Telerik:RadGrid
I noticed that you have opened three threads with the same question, please stick all the answers to the original thread you have opened.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.