void SetPriceType() { List <string> price = new List <string> { "Hourly", "Daily", "Monthly", "TBD" }; foreach (View gPrice in gridPriceType.Children.ToList()) { gridPriceType.Children.Remove(gPrice); } gridPriceType.RowDefinitions = new RowDefinitionCollection(); gridPriceType.ColumnDefinitions = new ColumnDefinitionCollection(); gridPriceType.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); foreach (string p in price) { gridPriceType.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); } ServiceButton priceButton; for (int i = 0; i < price.Count; i++) { priceButton = new ServiceButton(); priceButton.Text = price.ElementAt(i); priceButton.Margin = new Thickness(5, 5, 5, 5); //Image image = new Image(); //image.Source = "selected.png"; //image.Aspect = Aspect.AspectFit; //image.Margin = new Thickness(20, 15, 0, 15); //image.HorizontalOptions = LayoutOptions.End; //image.IsVisible = false; gridPriceType.Children.Add(priceButton, i, 0); //gridPriceType.Children.Add(image, i, 0); } }
//void SetStatus() //{ // IEnumerable<string> statusList = new List<string>() { "Available", "Not available" }; // rgHelperStatus.ItemsSource = statusList; // StackLayout content = (StackLayout)rgHelperStatus.Content; // Radio rg = null; // for (int i = 0; i < content.Children.Count; i++) // { // rg = (Radio)(content.Children[i]); // rg.Margin = new Thickness(0, 0, 20, 0); // rg.VerticalOptions = LayoutOptions.Center; // } //} async void SetServices() { #region set services IList <ServiceModel> services = await(new Utilities()).GetServicesAsync(); int servicesCount = services.Count(); for (int i = 0; i < (servicesCount - 1) / 3 + 1; i++) { gridServices.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); } for (int i = 0; i < 3; i++) { gridServices.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); } gridServices.Padding = new Thickness(0, 0, 10, 0); ServiceButton serviceButton; for (int i = 0; i < servicesCount; i++) { serviceButton = new ServiceButton(); serviceButton.Text = services.ElementAt(i).ServiceName; serviceButton.Margin = new Thickness(5, 5, 5, 5); serviceButton.HorizontalOptions = LayoutOptions.FillAndExpand; Image image = new Image(); image.Source = "selected.png"; image.Aspect = Aspect.AspectFit; image.Margin = new Thickness(20, 15, -5, 15); image.HorizontalOptions = LayoutOptions.End; image.IsVisible = false; gridServices.Children.Add(serviceButton, i % 3, i / 3); gridServices.Children.Add(image, i % 3, i / 3); #endregion } App.Database.DeleteService(); App.Database.SaveServices(services); }