Example #1
0
        private StackLayout GetChild(AccordianViewDemoModel model)
        {
            var parentlayout = new StackLayout();

            if (model.AttachedEquipments == null || model.AttachedEquipments.Count == 0)
            {
                var layout = new StackLayout();
                var text   = new Label
                {
                    Text      = "No Data",
                    Margin    = new Thickness(10, 5, 0, 0),
                    TextColor = Color.FromHex("#808285"),
                    FontSize  = 14
                };
                layout.Children.Add(text);
                parentlayout.Children.Add(layout);
            }
            else
            {
                var groupedEquip = model.AttachedEquipments.GroupBy(t => t.Brand).ToList();
                foreach (var equipment in groupedEquip)
                {
                    var layout = new StackLayout();
                    var text   = new Label
                    {
                        Text           = "Data" + " : " + equipment.Key,
                        Margin         = new Thickness(10, 5, 0, 0),
                        TextColor      = Color.FromHex("#808285"),
                        FontAttributes = FontAttributes.Bold,
                        FontSize       = 14
                    };
                    layout.Children.Add(text);
                    foreach (var models in equipment)
                    {
                        layout.Children.Add(CreateModelDetails("Sample Data", models.ModelNumber));
                        layout.Children.Add(CreateModelDetails("Sample Data 2", models.SerialNumber));
                    }

                    parentlayout.Children.Add(layout);
                }
            }
            return(parentlayout);
        }
Example #2
0
        private void GetData()
        {
            try
            {
                AccordianViewDemoList = new List <AccordianViewDemoModel>();

                AccordianViewDemoModel item = new AccordianViewDemoModel();

                var eq1 = new XamarinCustomUI.Models.Item
                {
                    AddressId    = 1,
                    Brand        = "testbrand",
                    ContractId   = 111111,
                    EquipmentID  = 1002,
                    ModelNumber  = "Model 330827827",
                    SerialNumber = "Serial No: 373289"
                };

                var eq2 = new XamarinCustomUI.Models.Item
                {
                    AddressId    = 2,
                    Brand        = "testbrand 2",
                    ContractId   = 22222,
                    EquipmentID  = 23345,
                    ModelNumber  = "Model 37883",
                    SerialNumber = "Serial No: 388389"
                };

                item.Title = "View 1";
                item.AttachedEquipments.Add(eq1);
                item.AttachedEquipments.Add(eq2);

                AccordianViewDemoList.Add(item);

                AccordianViewDemoModel item2 = new AccordianViewDemoModel();


                var eq3 = new XamarinCustomUI.Models.Item
                {
                    AddressId    = 1,
                    Brand        = "testbrand",
                    ContractId   = 111111,
                    EquipmentID  = 1002,
                    ModelNumber  = "Model 330827827",
                    SerialNumber = "Serial No: 373289"
                };

                var eq4 = new XamarinCustomUI.Models.Item
                {
                    AddressId    = 2,
                    Brand        = "testbrand 2",
                    ContractId   = 22222,
                    EquipmentID  = 23345,
                    ModelNumber  = "Model 37883",
                    SerialNumber = "Serial No: 388389"
                };

                item2.Title = "View 2";
                item2.AttachedEquipments.Add(eq3);
                item2.AttachedEquipments.Add(eq4);

                AccordianViewDemoList.Add(item2);
            }
            catch (Exception ex)
            {
            }
        }