This question is locked. New answers and comments are not allowed.
Hello all,
I am building a GridView with 20 columns showing some 150 rows. Since this is quite a wide table, and I want the user to be able to edit the table easily, I decided to use a RowDetailsTemplate that will actually be a form with all the edditable data from the selected row. I tried doing this like in the "Row Details" sample that is installed with the 2009 Q2 release (i.e. with the details view in a separate user control). The problem is that when I do that, the grid trows me an OutOfMemoryException. If on the other hand, I put the template directly in the grid control's resources, it works just fine.
Here are a few lines of code to show what I'm doing:
In the Grid's resources:
In the GridView's definition:
I am building a GridView with 20 columns showing some 150 rows. Since this is quite a wide table, and I want the user to be able to edit the table easily, I decided to use a RowDetailsTemplate that will actually be a form with all the edditable data from the selected row. I tried doing this like in the "Row Details" sample that is installed with the 2009 Q2 release (i.e. with the details view in a separate user control). The problem is that when I do that, the grid trows me an OutOfMemoryException. If on the other hand, I put the template directly in the grid control's resources, it works just fine.
Here are a few lines of code to show what I'm doing:
In the Grid's resources:
| <Grid.Resources> |
| <DataTemplate x:Key="PropertySetDetails"> |
| <local:PropertySetDetails /> |
| </DataTemplate> |
| </Grid.Resources> |
In the GridView's definition:
| <telerikGridView:RadGridView x:Name="propertySetGridView" Grid.Row="2" |
| CanUserInsertRows="true" AutoGenerateColumns="False" |
| RowDetailsTemplate="{StaticResource PropertySetDetails}" |
| RowDetailsVisibilityMode="VisibleWhenSelected"> |
In the user control file for the details view (in the same silverlight project) I have a grid with some controls:
| <UserControl x:Class="MyProject.PropertySetDetails" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
| <Grid x:Name="DetailsLayoutRoot"> |
| <Grid> |
| <Grid.ColumnDefinitions> |
| ... |
| </Grid.ColumnDefinitions> |
| <Grid.RowDefinitions> |
| ... |
| </Grid.RowDefinitions> |
| ... |
| <TextBlock Text="Name" Grid.Column="1" Grid.Row="1"/> |
| <TextBox x:Name="nameTextBox" Grid.Column="2" Grid.Row="1" Text="{Binding Name}" /> |
| </Grid> |
| </Grid> |
| </UserControl> |
Now this gives me the exception. Like I said, if I take out the grid markup from the separate file and put it the GridView's file (in the resources section), it works!
What am I doing wrong? I am new to Silverlight (and C#) so please take that into consideration in your reply.
Thanks in advance,
AM.
