Moving

The host offers MoveFirstAsync, MovePreviousAsync, MoveNextAsync, MoveLastAsync, MoveToRecordAsync(block, index), GoToItemAsync, SwitchToBlockAsync and TrySetActiveBlock. History: NavigateBackAsync, NavigateForwardAsync, CanNavigateBack, CanNavigateForward, GetNavigationHistory, ClearNavigationHistory. Bookmarks: SetBookmark, GoToBookmark, RemoveBookmark, ClearBookmarks. Tab order: GetNextItem, GetPreviousItem, SetTabOrder, GetTabOrder.

Item sequence on Tab or Enter

  1. The presenter validates the value.
  2. The item is validated with OnBlur timing.
  3. WhenValidateItem fires.
  4. PostTextItem fires.
  5. The KeyNextItem or KeyPreviousItem key trigger fires.
  6. PreTextItem fires on the target item.
  7. WhenNewItemInstance fires on the target item.
  8. Focus moves.

Shortcut keys

Both hosts bind these keys.

KeyCommand
F4DuplicateRecord
F6CreateRecord
Shift+F6DeleteRecord
F7Key trigger F7, which enters query mode
F8ExecuteQuery
F9ListValues (shows the list of values)
F10Commit
Ctrl+RRollback
Ctrl+DeleteClearRecord
Ctrl+DownNextRecord
Ctrl+UpPreviousRecord

The navigation bar

WinFormBlockNavigationBar and BeepWpfBlockNavigationBar implement IBlockNavigationBar. Properties: BlockName, CurrentRecordIndex, RecordCount, IsQueryMode. Events: FirstClicked, PreviousClicked, NextClicked, LastClicked, RecordIndexChanged, NewRecordClicked, DeleteClicked, QueryClicked, ExecuteClicked, SaveClicked, RollbackClicked.

Assign the bar to the block's NavigationBar property before the block is bound. The WinForms host finds bars on its own and matches them to blocks by BlockName. The WPF host does not, so assign it yourself.

An author can hide or disable commands through BlockDefinition.Navigation. It holds First, Previous, Next, Last, NewRecord, Delete, Query, Execute, Save and Rollback, each a BlockNavigationCommand with Visible and Enabled. A command left null is not authored. An authored Enabled is combined with the live state using AND, so authoring can turn a command off but cannot force it on.

Query by example

EnterQueryModeAsync, ExitQueryModeAsync and ExecuteQueryByExampleAsync(block, criteria), where criteria is a dictionary of field name to QueryCriterion(Value, Operator, IsEnabled). QueryOperator members: Equals, NotEquals, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, Like, NotLike, In, NotIn, Between, IsNull, IsNotNull, StartsWith, EndsWith, Contains.

In query mode, WinFormBlockHost.ExecuteQueryAsync builds the criteria from presenters that allow query and hold a value.

Query templates: SaveQueryTemplate, LoadQueryTemplate, GetQueryTemplates, DeleteQueryTemplate. History: GetQueryHistory, ClearQueryHistory.