Beispiel #1
0
        private void lstView_ItemSelected(object sender, ItemTappedEventArgs e)
        {
            try
            {
                SubCategory.Clear();

                //   string itm = e.SelectedItem.ToString();
                var dataItem = e.Item as CategorySubC1;

                //  dataItem.TextColor = Color.Red;

                foreach (CategorySubC1 item in CategoryItems)
                {
                    item.TextColor = dataItem.Equals(item) ? Color.Red : Color.Gray;
                    item.OnPropertyChanged();
                }


                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                var catesubcat = memberDatabase1.GetCatSubCat();

                foreach (var category in catesubcat.Where(x => x.CategoryID == dataItem.CategoryID))
                {
                    SubCategory.Add(new CategorySubC1 {
                        SubCategoryName = category.SubCategoryName, SubCategoryID = category.SubCategoryID, SubTextColor = Color.FromHex(category.SubTextColor), img = ImageSource.FromFile(category.img)
                    });
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Beispiel #2
0
        public void BindCategoryfromSqlite()
        {
            catsubcat1      = new CategorySubCat();
            memberDatabase1 = new MemberDatabase();

            var catesubcat = memberDatabase1.GetCatSubCat();

            List <CategorySubCat> list = catesubcat
                                         .GroupBy(a => a.CategoryName)
                                         .Select(g => g.First())
                                         .ToList();

            foreach (CategorySubCat var1 in list)
            {
                CategoryItems.Add(new CategorySubC1 {
                    CategoryID = var1.CategoryID, CategoryName = var1.CategoryName
                });
            }
        }