Introduction

edit

Meziantou.Framework.WPF is a set of small helpers for WPF applications that follow the MVVM pattern: the pieces that most applications write again in every project.

What you can do with it

  • Bind buttons and menus to methods of a view model, synchronous or asynchronous, with DelegateCommand. See Commands.
  • Fill a list or a combo box with the values of an enum, with display names from the [Display] attribute. See Enum values.
  • Convert a boolean to any value in a binding, such as a Visibility or a text. See Boolean converter.
  • Come back to the UI thread after background work with await dispatcher.SwitchToDispatcherThread(). See Dispatcher.
  • Close a window with the Escape key. See Closing on Escape.

The collection that can be updated from any thread while it is bound to a control, ConcurrentObservableCollection<T>, is in the Meziantou.Framework.Threading package. See Observable collection.

Namespace

The types are in the Meziantou.Framework.WPF namespace:

TypeContains
DelegateCommand, IDelegateCommandCommands that call delegates
EnumValuesExtension, LocalizedEnumValuesExtension, LocalizedEnumValueMarkup extensions that list the values of an enum
BooleanToValueConverterA value converter for booleans
DispatcherExtensionsSwitchToDispatcherThread
WindowUtilitiesThe CloseOnEscapeKeyDown attached property

Next steps