| 123456789101112131415161718192021222324252627282930313233343536373839404142 | 
							- using System;
 
- using System.Windows.Controls;
 
- using Comal.Classes;
 
- using InABox.Core;
 
- using InABox.DynamicGrid;
 
- namespace PRSDesktop
 
- {
 
-     public class ContactGrid : DynamicDataGrid<Contact>
 
-     {
 
-         private bool bShowAll;
 
-         public ContactGrid()
 
-         {
 
-             AddButton("Show All", null, ToggleFavourites);
 
-         }
 
-         protected override void DoReconfigure(FluentList<DynamicGridOption> options)
 
-         {
 
-             base.DoReconfigure(options);
 
-             options.AddRange(
 
-                 DynamicGridOption.RecordCount,
 
-                 DynamicGridOption.FilterRows,
 
-                 DynamicGridOption.SelectColumns
 
-             );
 
-         }
 
-         private bool ToggleFavourites(Button sender, CoreRow[] rows)
 
-         {
 
-             bShowAll = !bShowAll;
 
-             UpdateButton(sender, null, bShowAll ? "Favourites" : "Show All");
 
-             return true;
 
-         }
 
-         protected override void Reload(Filters<Contact> criteria, Columns<Contact> columns, ref SortOrder<Contact>? sort, Action<CoreTable?, Exception?> action)
 
-         {
 
-             if (!bShowAll)
 
-                 criteria.Add(new Filter<Contact>(x => x.Favourite).IsEqualTo(true));
 
-             base.Reload(criteria, columns, ref sort, action);
 
-         }
 
-     }
 
- }
 
 
  |