private void PopulateEventCategory() { _eventButtons = new List<TouchButton>(); var categoryList = CalendarDAL.GetInstance().GetCategories(); AddColumns(); int col = 0,row=-1; foreach (DTOEventCategory category in categoryList) { if(col == 0) { grdCategory.RowDefinitions.Add(new RowDefinition()); row++; } TouchOptionItem item = new TouchOptionItem(); item.CategoryText = category.Title; item.CateogoryButton.Tag = category.Id; grdCategory.Children.Add(item); item.SetValue(Grid.ColumnProperty, col); item.SetValue(Grid.RowProperty, row); item.Margin = new Thickness(15,5,15,5); _eventButtons.Add(item.CateogoryButton); col++; if (col == ITEMS_PER_COLUMN) col = 0; } }
private void PopulateSubCategory() { grdCategory.Children.Clear(); grdCategory.RowDefinitions.Clear(); grdCategory.ColumnDefinitions.Clear(); if(_subCategoryItems.Count > 0) { foreach (var item in _subCategoryItems) { FrameworkManager.UnRegisterElement(item); } _subCategoryItems.Clear(); } var categoryList = DiningDAL.GetInstance().GetSubCategories(Convert.ToInt32(_categoryId)); AddColumns(); int col = 0, row = -1; foreach (var category in categoryList) { if (col == 0) { grdCategory.RowDefinitions.Add(new RowDefinition()); row++; } var item = new TouchOptionItem(); item.CategoryText = category.Title; item.CateogoryButton.Tag = category.Id; grdCategory.Children.Add(item); item.SetValue(Grid.ColumnProperty, col); item.SetValue(Grid.RowProperty, row); item.Margin = new Thickness(15, 10, 15, 10); _subCategoryItems.Add(item.CateogoryButton); FrameworkManager.RegisterElement(item.CateogoryButton as IMTouchControl, false, new[] { TouchAction.Tap }); item.CateogoryButton.Click += CateogoryButton_Click; col++; if (col == NO_OF_ITEMS_PER_COLUMN) col = 0; } }
private void PopulateEventCategory() { _transportationButtons = new List<TouchButton>(); var categoryList = TransportationDAL.GetInstance().GetCategories(); AddColumns(); int col = 0, row = -1; foreach (DTOTransportationCategory category in categoryList) { if (col == 0) { grdCategory.RowDefinitions.Add(new RowDefinition()); row++; } var item = new TouchOptionItem(); item.CategoryText = category.Title; item.CateogoryButton.Tag = category.Id; grdCategory.Children.Add(item); item.SetValue(Grid.ColumnProperty, col); item.SetValue(Grid.RowProperty, row); if (col == 0) item.Margin = new Thickness(10, 5, 10, 0); else item.Margin = new Thickness(100, 5, 10, 0); _transportationButtons.Add(item.CateogoryButton); item.CateogoryButton.Click += CateogoryButton_Click; col++; if (col == NO_OF_ITEM_IN_COLUMN) col = 0; } }