I'm trying to add row details to my RadGridView based on my model class. I'd like to avoid adding a lot of XAML code if possible.
Could someone please take a look at the attached example?
Stenly
Telerik team
commented on 13 Dec 2023, 04:43 PM
I examined the provided example and the sample JSON file, and this structure can be displayed in the RowDetailsTemplate property of RadGridView. However, the child data, meaning the two collections (Contacts and Timetables) cannot be displayed simultaneously in one RadGridView control.
With this being said, my suggestion would be to use two RadGridView controls, one for the Contacts and one for the Timetables collections. This will produce the following result when such a layout is configured using the sample application that you provided:
Such a layout can be achieved using the following XAML code:
Good evening, Thank you for your quick feedback. After analyzing your proposal, and taking into account the constraint of being able to display only one collection as a detail in the main grid, yes this solution allows us to achieve the primary objective of presenting collection data to the user.
However, could you please give us more details on the implementation of the final solution? Thank you again for your prompt response, it's really great !
I am not sure that I fully understand the part regarding the additional details on implementing this inquiry, however, I have attached the modified version of the sample project, which you provided. It contains the proposal from my previous reply.
I examined the provided example and the sample JSON file, and this structure can be displayed in the RowDetailsTemplate property of RadGridView. However, the child data, meaning the two collections (Contacts and Timetables) cannot be displayed simultaneously in one RadGridView control.
With this being said, my suggestion would be to use two RadGridView controls, one for the Contacts and one for the Timetables collections. This will produce the following result when such a layout is configured using the sample application that you provided:
Such a layout can be achieved using the following XAML code:
<telerik:RadGridView.RowDetailsTemplate> <DataTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <telerik:RadGridView ItemsSource="{Binding Contacts}"/> <telerik:RadGridView ItemsSource="{Binding Timetables}" Grid.Row="1"/> </Grid> </DataTemplate> </telerik:RadGridView.RowDetailsTemplate>
Will such a layout of the data be applicable to your current project requirements?
Thank you for your quick feedback. After analyzing your proposal, and taking into account the constraint of being able to display only one collection as a detail in the main grid, yes this solution allows us to achieve the primary objective of presenting collection data to the user.
However, could you please give us more details on the implementation of the final solution?
Thank you again for your prompt response, it's really great !