RadGrid Add and Remove

1 Answer 57 Views
GridView
Sudeshna
Top achievements
Rank 1
Sudeshna asked on 15 Feb 2023, 09:08 PM

Hi , 

In one of my wpf window I have two grids. In one grid I only have product name that lists all the products available and another grid i have product details( id, name, price etc.) and there is a add and remove button. If I select one product name add click add then it should add the details to the product details grid and also should be able to remove it. How can I implement it. Do you have any sample code?

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 20 Feb 2023, 08:17 AM

Hello Sudeshna,

I have prepared a sample project to show one way of achieving this requirement, which is attached to this answer.

The attached test application's setup is two RadGridView controls that have two separate ObservableCollection instances that contain elements of the same type (the type in the project is ProductInformation). One RadGridView displays only one property, which is the ProductInformation instance's Name property (name of the product), whereas the second one displays the rest of the ProductInformation properties and their values. Via a button click (add button), the SelectedItem from the first RadGridView is included in the second RadGridView, which will display its details. Via another button click (remove button), the SelectedItem from the second RadGridView will be removed. 

The test application does not contain code-behind and everything is performed in the view model for the RadGridView elements.

I hope the project will be of help to you when implementing this functionality on your end.

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Sudeshna
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or