I have been using the RadGridView for a project and I am having an issue with custom templating and styling. I have set up custom styles for the RadGridView, GridViewRows, and a few other controls.
The problem I am having is that my GridViewRow style is not being applied to the "Click here to add new row" row, nor the editable row that appears when you click it.
To further compound everyone's confusion, when I create a basic custom style and apply it to the "NewRowStyle" property, it messes up the way the normal rows as well as the headers of the grid display.
Am I missing a step on applying custom templates and styles?
Thank you.
(For further information, I am using the latest Q3 trial release for WPF. Development is in Visual Studio 2010).
7 Answers, 1 is accepted
If you need to change the appearance of this row you need to edit the template of GridViewNewRow with defined TargetType GridViewNewRow, the style targeted at GridViewRow will not be applied to this row.
You may find attached sample project that demonstrates how to modify GridViewNewRow.
Vanya Pavlova
the Telerik team

Thank you, that solved that problem.
I have one additional question to ask, though. When I click on the insert row and the cells go into edit mode, I can't seem to adjust the styling of those cells. They still show up with the default white background with gold border and black text. I've gone up and down the custom templates I have set up for both the standard RadGridViewRow as well as the NewRow you just provided and can't seem to find where to adjust those specific colors. Could you help point me in the right direction please?
Thanks!
~Jason
You may achieve this result through handling RadGridView's BegginingEdit event as it is shown below:
private
void
RadGridView1_BeginningEdit(
object
sender, Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs e)
{
var row=e.Row
as
GridViewNewRow;
if
(row!=
null
)
{
var cells=row.ChildrenOfType<GridViewCell>().ToList();
foreach
(var cell
in
cells)
{
cell.Background=
new
SolidColorBrush(Colors.Blue);
cell.Foreground=
new
SolidColorBrush(Colors.Yellow);
//here you may refer your own defined style
//cell.Style=this.Resourses["st1"] as Style;
}
}
}
You may also use the following help article that will show you how to control GridViewCell's appearance in its different states:
http://www.telerik.com/help/wpf/gridview-styling-cell.html
Best wishes,
Vanya Pavlova
the Telerik team

I've been working with this for a few days but I still cannot for the life of me obtain the results that I want.
When I insert a new row, and the first cell goes into edit mode, it always has a white background, orange border, and blue highlight over the black text. I created a custom style via expression blend but it does not apply at all when the cell is in edit mode. I am trying to adjust it so that, when you are editing (and thus typing into a cell), it will still be a black background with white text. Am I missing a step somewhere?
Thanks,
~Jason
This occurred because the GridViewCell is in edit mode and the Background of the cell is changed. The white background comes from default editing element, which is a TextBox. In this case you need to handle PreparingCellForEdit event of RadGridView and customize the TextBox in the way you need.
Please find attached a sample project that demonstrates the previous approaches.
Vanya Pavlova
the Telerik team

Attached app is working. However, how can we make sure the AddRow always on the bottom of the grid even after grouping and sorting?

Attached app is working. However, how can we make sure the AddRow always on the bottom of the grid even after grouping and sorting?