1234567891011121314151617181920212223242526272829 |
- using System;
- using System.Linq;
- using Xamarin.Forms;
- namespace comal.timesheets
- {
- public class ProductSelectionPage : SelectionPage
- {
- public ProductSelectionPage(Action<ProductShell> action)
- : base(
- (string)"Select Product",
- (SelectionPageMode)SelectionPageMode.Immediate,
- (columns) =>
- {
- columns
- .BeginUpdate()
- .Clear()
- .Add(new MobileGridTextColumn<ProductShell>()
- { Column = x => x.Code, Width = GridLength.Auto })
- .Add(new MobileGridTextColumn<ProductShell>()
- { Column = x => x.Name, Width = GridLength.Star })
- .EndUpdate();
- },
- (refresh) => App.Data.Products.Refresh(refresh),
- (items) => action?.Invoke(items.FirstOrDefault() as ProductShell)
- ) { }
- }
- }
|