I would like to know and have the sample project in WPF how to add new RowDetailsTemplate for every row of RadGridView dynamically because every row detail template will having different binding and different controls and navigation buttons at run time.
Please let me know either can I add a new RowDetailsTemplate for every row of RadGridView dynamically or not. I can, please provide the sample application how to achieve this.
My Code is following which adds but while expending row details it throw an exception which is following after the code.
class testApp
{
.....................
..................
private void rgvParent_RowLoaded(object sender, RowLoadedEventArgs e)
{
DataTemplate dt = (DataTemplate)XamlReader.Parse(RowDetailsTemplate(count));
e.GridViewDataControl.RowDetailsTemplate = dt;
}
private string RowDetailsTemplate(int count)
{
return @" <DataTemplate
xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:telerik=""http://schemas.telerik.com/2008/xaml/presentation""
xmlns:Event=""clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity""
xmlns:cmd=""clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"" >
<telerik:RadGridView Name=""playersGrid" + count.ToString() + @""" GridLinesVisibility=""Both"" IsReadOnly=""True"" AutoGenerateColumns=""true"" VerticalAlignment=""Top""
CanUserFreezeColumns=""False"" ShowGroupPanel=""false"" RowIndicatorVisibility=""Collapsed"" Width=""Auto"" Height=""Auto""
ScrollViewer.VerticalScrollBarVisibility=""auto"" ScrollViewer.CanContentScroll=""True"" ScrollViewer.HorizontalScrollBarVisibility=""auto""
SnapsToDevicePixels=""False"" VerticalContentAlignment=""Top"" CanUserResizeColumns=""False"" SelectionMode=""Single"" SelectionUnit=""FullRow""
Background=""#EAF3FC"" GroupPanelBackground=""#CFE3F9"">
<telerik:RadGridView.ColumnGroups>
<telerik:GridViewColumnGroup Name=""DefaultGroup" + count.ToString() + @""">
</telerik:GridViewColumnGroup>
</telerik:RadGridView.ColumnGroups>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn ColumnGroupName=""DefaultGroup" + count.ToString() + @""" />
<telerik:GridViewDataColumn ColumnGroupName=""DefaultGroup" + count.ToString() + @""" />
<telerik:GridViewDataColumn ColumnGroupName=""DefaultGroup" + count.ToString() + @""" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>";
}
}
While expending row details it throws the following exception.
InvalidOperationException was unhandled
An infinite loop appears to have resulted from repeatedly invalidating the TimeManager during the Layout/Render process.
I hope someone will provide solution for this requirement.
Thanks
Laxman