Hello ed cooke,
Currently, this is not available out-of-the-box, but we will think about adding this feature. Meanwhile, I have prepared and attached a sample project that does this. Here is how I did it:
<
UserControl
x:Class
=
"NewRowRowDetails.MainPage"
xmlns:telerik
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:my
=
"clr-namespace:NewRowRowDetails"
mc:Ignorable
=
"d"
d:DesignHeight
=
"700"
d:DesignWidth
=
"700"
>
<
UserControl.Resources
>
<
my:MyViewModel
x:Key
=
"MyViewModel"
/>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
DataContext
=
"{StaticResource MyViewModel}"
>
<
Grid.Resources
>
<
DataTemplate
x:Key
=
"RowDetailsTemplate"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Name:"
Width
=
"100"
/>
<
TextBox
Text
=
"{Binding Name, Mode=TwoWay}"
Width
=
"100"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Established:"
Width
=
"100"
/>
<
TextBox
Text
=
"{Binding Established, Mode=TwoWay}"
Width
=
"100"
/>
</
StackPanel
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Capacity:"
Width
=
"100"
/>
<
TextBox
Text
=
"{Binding StadiumCapacity, Mode=TwoWay}"
Width
=
"100"
/>
</
StackPanel
>
</
StackPanel
>
</
DataTemplate
>
</
Grid.Resources
>
<
telerik:RadGridView
Grid.Row
=
"0"
ShowInsertRow
=
"True"
Name
=
"clubsGrid"
ItemsSource
=
"{Binding Clubs}"
AutoGenerateColumns
=
"False"
RowDetailsTemplate
=
"{StaticResource RowDetailsTemplate}"
Margin
=
"5"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewToggleRowDetailsColumn
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Established}"
Header
=
"Est."
DataFormatString
=
"{}{0:yyyy}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding StadiumCapacity}"
Header
=
"Stadium"
DataFormatString
=
"{}{0:N0}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
UserControl
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Data;
using
System.Collections;
using
System.Collections.ObjectModel;
using
Telerik.Windows.Controls.GridView;
namespace
NewRowRowDetails
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
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;
}
}
}
The whole project is attached. I hope this helps.
Kind regards,
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.