ProductSelectionPage.cs 1013 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Linq;
  3. using Xamarin.Forms;
  4. namespace comal.timesheets
  5. {
  6. public class ProductSelectionPage : SelectionPage
  7. {
  8. public ProductSelectionPage(Action<ProductShell> action)
  9. : base(
  10. (string)"Select Product",
  11. (SelectionPageMode)SelectionPageMode.Immediate,
  12. (columns) =>
  13. {
  14. columns
  15. .BeginUpdate()
  16. .Clear()
  17. .Add(new MobileGridTextColumn<ProductShell>()
  18. { Column = x => x.Code, Width = GridLength.Auto })
  19. .Add(new MobileGridTextColumn<ProductShell>()
  20. { Column = x => x.Name, Width = GridLength.Star })
  21. .EndUpdate();
  22. },
  23. (refresh) => App.Data.Products.Refresh(refresh),
  24. (items) => action?.Invoke(items.FirstOrDefault() as ProductShell)
  25. ) { }
  26. }
  27. }