How to build a view to show my data

Hello i've written some classes


public class Person

    {

        public int Id { get; set; }

        public string Name { get; set; }

        public int Age { get; set; }

        public int Points { get; set; }

        public string Status { get; set; }

    }



    public class Item

    {

        public int Id { get; set; }

        public string Name { get; set; }

        public int DefaultAmount { get; set; }

    }


    public class ItemsOrders

    {

        public Person Person { get; set; }

        public List<Item> OrderedItems { get; set; }

    }


    public class ViewModel

    {

        //...


        private ObservableCollection<ItemsOrders> _orders;


        public ObservableCollection<ItemsOrders> Orders

        {

            get { return _orders; }

            set { _orders = value; }

        }


        //...

    }



How to build a view that shows the ViewModel and looks like:

sample.jpg


The check box rows are active when checkbox is check.

Each person has assigned some items. These items are stored in OrderedItems property in ItemsOrdersClass. Each person have assigned 0 or more Items

Which controls use to build the view and how to bind data?


3 Replies

MA Mohanram Anbukkarasu Syncfusion Team August 20, 2021 09:36 AM UTC

Hi James, 

Thanks for contacting Syncfusion products.  

From the provided details, we suspect that you are asking for a feature like Master-Details View in SfDataGrid. You can show checkbox in the child view using GridCheckBoxColumn / GridCheckBoxSelectorColumn based on your scenario. Please refer the below given help documentation.  

UG references :  

However we are little unclear about the below marked part in the provided image.  
 


Please revert to us with more details. It will be helpful for us to check and provide a prompt solution.  

Regards, 
Mohanram A. 



JA James replied to Mohanram Anbukkarasu August 20, 2021 10:49 AM UTC

Thank you for help.

The marked parts have to act like Numeric UpDown (in WinForms World :-)). The default value for this controls is read from the database ( DefaultAmount  property in Item class) and user adjust this value as he needs. In my example a user chose 1 Laptop and 1 Keyboard. User can only change values in rows that he selected by checkbox.



VS Vijayarasan Sivanandham Syncfusion Team August 23, 2021 02:00 PM UTC

Hi James,

Thanks for the update.

The SfDataGrid provides support to represent additional information of a row using TemplateViewDefinition that can be defined in SfDataGrid. For more information, please refer the below user guide documentation link, 
Please let us know if you have any concerns in this.

Regards,
Vijayarasan S 


Loader.
Up arrow icon