5 Answers, 1 is accepted
The GridViewNewRow has not details presenter, but we plan to add one for a future release.
Anyway, there is a very simple workaround. You can add a new data item and its row will become a "normal" row. Then you can toggle its row details manually. Here is how to do this:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Data;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Imaging;
using
System.Windows.Navigation;
using
System.Windows.Shapes;
using
Telerik.Windows.Data;
using
Telerik.Windows.Controls;
using
System.Collections.ObjectModel;
using
Telerik.Windows.Controls.GridView;
namespace
NewRowDetails
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public
partial
class
Window1 : Window
{
public
Window1()
{
InitializeComponent();
this
.clubsGrid.AddingNewDataItem +=
new
EventHandler<Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs>(clubsGrid_AddingNewDataItem);
}
void
clubsGrid_AddingNewDataItem(
object
sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
e.Cancel =
true
;
Club newClub =
new
Club();
ObservableCollection<Club> itemsSource = (ObservableCollection<Club>)
this
.clubsGrid.ItemsSource;
itemsSource.Add(newClub);
this
.clubsGrid.CurrentItem = newClub;
this
.clubsGrid.ScrollIntoViewAsync(newClub,
this
.OnNewClubAdded);
}
private
void
OnNewClubAdded(FrameworkElement row)
{
((GridViewRow)row).DetailsVisibility = Visibility.Visible;
}
}
}
There are many different configurations that you can achieve for row details visibility.
The display mode of the Row Details can be specified by using the RowDetailsVisibilityMode property. It can have one of the following values:
- Collapsed - row details won't be displayed for any of the rows.
- Visible - row details will be displayed for each of the rows.
- VisibleWhenSelected - row details will be displayed only for the selected row.
Furthermore, you can specify visibility on a per-row basis by using the GridViewRow.DetailsVisibility like I have done above. So you can listen for selection events and toggle each row's details visibility according to your needs.
This help article discusses row details visibility. I have also attached a sample project. I hope this helps.
Sincerely yours,
Ross
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.

I have been working on this for a while now and just cant get it to work..
I want to click the Add New Item bar and show the row as rowdetails not cells in edit mode.
private void OnAddNewRow(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
e.Cancel =
true;
Workflow wf = new Workflow();
wf.ProductID =
"GL";
e.NewObject = wf;
this.WorkflowConfigGrid.ScrollIntoViewAsync(wf, (row) =>
{
((
GridViewRow)row).DetailsTemplate = (DataTemplate)WorkflowConfigGrid.RowDetailsTemplate;
((
GridViewRow)row).DetailsVisibility = Visibility.Visible;
});
}
Wont work.
Any ideas?
Thanks
Dan
It is not working, because you are not doing it like in the sample project I have provided.
Add the new object to the source collection, do not set it as e.NewItem.
Also, you do not need to do anything with the template. It is just a template.
If you do it like shown in the project -- it will work.
I hope this helps.
Regards,
Ross
the Telerik team

Nope.
Now maybe this is because I am in WPF, but I doubt it.
OnNewClubAdded Never gets called.
Is there a dependency on ObservableCollection here? I dont think so.
Thoughts.
private void OnAddNewRow(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
e.Cancel =
true;
Workflow wf = new Workflow();
wf.WorkflowID = -1;
wf.ProductID =
"GL";
context.Workflows.Attach(wf);
context.SubmitChanges();
WorkflowConfigGrid.CurrentItem = wf;
this.WorkflowConfigGrid.ScrollIntoViewAsync(wf, OnNewClubAdded);
//{
// ((GridViewRow)row).DetailsVisibility = Visibility.Visible;
//});
}
private void OnNewClubAdded(FrameworkElement row)
{
((
GridViewRow)row).DetailsVisibility = Visibility.Visible;
}

It is dependent on the ObservableCollection.
I get it.
Thanks
Dan