public JobDetailsPage() { TableSection mainSection = new TableSection(); mainSection.Add(new DataElementCell("Title", "Description")); mainSection.Add(new DataElementCell("Customer.FullName", "Customer")); mainSection.Add(new DataElementCell("Customer.Address", "Address") { Height = 60 }); mainSection.Add(new DataElementCell("Customer.PrimaryContactNumber", "Telephone")); var statusCell = new DataElementCell("Status"); statusCell.ValueLabel.SetBinding <Job>(Label.TextColorProperty, job => job.Status, converter: new JobStatusToColorConverter()); mainSection.Add(statusCell); var equipmentSection = new TableSection("Equipment"); var equipmentRowTemplate = new DataTemplate(typeof(ImageCell)); equipmentRowTemplate.SetBinding(ImageCell.TextProperty, "Name"); equipmentRowTemplate.SetBinding(ImageCell.DetailProperty, "Description"); // I don't have images working on Android yet if (Device.OS == TargetPlatform.iOS) { equipmentRowTemplate.SetBinding(ImageCell.ImageSourceProperty, "ThumbImage"); } var equipmentListView = new ListView { RowHeight = 50, ItemTemplate = equipmentRowTemplate }; equipmentListView.SetBinding <Job>(ListView.ItemsSourceProperty, job => job.Equipments); var equipmentCell = new ViewCell { View = equipmentListView }; equipmentSection.Add(equipmentCell); var actionsSection = new TableSection("Actions"); TextCell completeJob = new TextCell { Text = "Mark Job as Complete", TextColor = AppStyle.DefaultActionColor }; completeJob.Tapped += async delegate { await this.CompleteJobAsync(); }; actionsSection.Add(completeJob); var table = new TableView { Intent = TableIntent.Form, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, Root = new TableRoot("Root") { mainSection, actionsSection, equipmentSection } }; table.SetBinding <Job>(TableView.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter(useLightTheme: true)); this.Title = "Job Details"; this.Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { new JobHeaderView(), table } }; this.BindingContextChanged += delegate { if (SelectedJob != null && SelectedJob.Equipments != null) { equipmentCell.Height = SelectedJob.Equipments.Count * equipmentListView.RowHeight; } }; }
public JobDetailsPage(JobService service) { this.jobService = service; this.Title = "Appointment Details"; TableSection mainSection = new TableSection("Customer Details"); mainSection.Add(new DataElementCell("CustomerName", "Customer")); mainSection.Add(new DataElementCell("Title", "Customer Notes")); mainSection.Add(new DataElementCell("CustomerAddress", "Address") { Height = 60 }); mainSection.Add(new DataElementCell("CustomerPhoneNumber", "Telephone")); var statusCell = new DataElementCell("Status"); statusCell.ValueLabel.SetBinding <Job>(Label.TextColorProperty, job => job.Status, converter: new JobStatusToColorConverter()); mainSection.Add(statusCell); var workSection = new TableSection("Work Performed"); var workRowTemplate = new DataTemplate(typeof(SwitchCell)); workRowTemplate.SetBinding(SwitchCell.TextProperty, "Name"); workRowTemplate.SetBinding(SwitchCell.OnProperty, "Completed"); //workRowTemplate.SetValue(TextCell.TextColorProperty, Color.White); // I don't have images working on Android yet //if (Device.OS == TargetPlatform.iOS) // equipmentRowTemplate.SetBinding (ImageCell.ImageSourceProperty, "ThumbImage"); var workListView = new ListView { RowHeight = 50, ItemTemplate = workRowTemplate }; workListView.SetBinding <Job>(ListView.ItemsSourceProperty, job => job.Items); var workCell = new ViewCell { View = workListView }; workSection.Add(workCell); var actionsSection = new TableSection("Actions"); TextCell completeJob = new TextCell { Text = "Mark Completed", TextColor = AppStyle.DefaultActionColor }; completeJob.Tapped += async delegate { await this.CompleteJobAsync(); }; actionsSection.Add(completeJob); var table = new TableView { Intent = TableIntent.Form, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, Root = new TableRoot("Root") { mainSection, workSection, actionsSection, } }; this.Content = new ScrollView { Orientation = ScrollOrientation.Vertical, Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { new JobHeaderView(leftPadding: 10, colorBackground: true), table } } }; this.BindingContextChanged += delegate { if (SelectedJob != null && SelectedJob.Items != null) { workCell.Height = SelectedJob.Items.Count * workListView.RowHeight; } }; }
public JobDetailsPage(JobService service) { this.jobService = service; this.Title = "Appointment Details"; TableSection mainSection = new TableSection("Customer Details"); mainSection.Add(new DataElementCell("CustomerName", "Customer")); mainSection.Add(new DataElementCell("Title", "Customer Notes")); mainSection.Add(new DataElementCell("CustomerAddress", "Address") { Height = 60 }); mainSection.Add(new DataElementCell("CustomerPhoneNumber", "Telephone")); var statusCell = new DataElementCell("Status"); statusCell.ValueLabel.SetBinding<Job>(Label.TextColorProperty, job => job.Status, converter: new JobStatusToColorConverter()); mainSection.Add(statusCell); var workSection = new TableSection("Work Performed"); var workRowTemplate = new DataTemplate(typeof(SwitchCell)); workRowTemplate.SetBinding(SwitchCell.TextProperty, "Name"); workRowTemplate.SetBinding(SwitchCell.OnProperty, "Completed"); //workRowTemplate.SetValue(TextCell.TextColorProperty, Color.White); // I don't have images working on Android yet //if (Device.OS == TargetPlatform.iOS) // equipmentRowTemplate.SetBinding (ImageCell.ImageSourceProperty, "ThumbImage"); var workListView = new ListView { RowHeight = 50, ItemTemplate = workRowTemplate }; workListView.SetBinding<Job>(ListView.ItemsSourceProperty, job => job.Items); var workCell = new ViewCell { View = workListView }; workSection.Add(workCell); var actionsSection = new TableSection("Actions"); TextCell completeJob = new TextCell { Text = "Mark Completed", TextColor = AppStyle.DefaultActionColor }; completeJob.Tapped += async delegate { await this.CompleteJobAsync(); }; actionsSection.Add(completeJob); var table = new TableView { Intent = TableIntent.Form, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, Root = new TableRoot("Root") { mainSection, workSection, actionsSection, } }; this.Content = new ScrollView { Orientation = ScrollOrientation.Vertical, Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { new JobHeaderView(leftPadding: 10, colorBackground: true), table } } }; this.BindingContextChanged += delegate { if (SelectedJob != null && SelectedJob.Items != null) workCell.Height = SelectedJob.Items.Count * workListView.RowHeight; }; }
public JobDetailsPage() { TableSection mainSection = new TableSection(); mainSection.Add(new DataElementCell("Title", "Description")); mainSection.Add(new DataElementCell("Customer.FullName", "Customer")); mainSection.Add(new DataElementCell("Customer.Address", "Address") { Height = 60 }); mainSection.Add(new DataElementCell("Customer.PrimaryContactNumber", "Telephone")); var statusCell = new DataElementCell("Status"); statusCell.ValueLabel.SetBinding<Job>(Label.TextColorProperty, job => job.Status, converter: new JobStatusToColorConverter()); mainSection.Add(statusCell); var equipmentSection = new TableSection("Equipment"); var equipmentRowTemplate = new DataTemplate(typeof(ImageCell)); equipmentRowTemplate.SetBinding(ImageCell.TextProperty, "Name"); equipmentRowTemplate.SetBinding(ImageCell.DetailProperty, "Description"); // I don't have images working on Android yet if (Device.OS == TargetPlatform.iOS) equipmentRowTemplate.SetBinding (ImageCell.ImageSourceProperty, "ThumbImage"); var equipmentListView = new ListView { RowHeight = 50, ItemTemplate = equipmentRowTemplate }; equipmentListView.SetBinding<Job>(ListView.ItemsSourceProperty, job => job.Equipments); var equipmentCell = new ViewCell { View = equipmentListView }; equipmentSection.Add(equipmentCell); var actionsSection = new TableSection("Actions"); TextCell completeJob = new TextCell { Text = "Mark Job as Complete", TextColor = AppStyle.DefaultActionColor }; completeJob.Tapped += async delegate { await this.CompleteJobAsync(); }; actionsSection.Add(completeJob); var table = new TableView { Intent = TableIntent.Form, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, Root = new TableRoot("Root") { mainSection, actionsSection, equipmentSection } }; table.SetBinding<Job>(TableView.BackgroundColorProperty, job => job.Status, converter: new JobStatusToColorConverter(useLightTheme: true)); this.Title = "Job Details"; this.Content = new StackLayout { Orientation = StackOrientation.Vertical, Children = { new JobHeaderView(), table } }; this.BindingContextChanged += delegate { if (SelectedJob != null && SelectedJob.Equipments != null) equipmentCell.Height = SelectedJob.Equipments.Count * equipmentListView.RowHeight; }; }