Skip to content

PeterHuberSg/WpfWindowsLib

Repository files navigation

Base WPF Window functionality for data entry

Table of content

About
Data Entry Samples Application
  Coding
  Further documentation
Build requirements
Structure WpfWindowsLib Solution
Project Status
Copyright

About

To support data entry on a Window, quite a bit of code is needed to decide if any data has been changed, i.e. the save button should be enabled and to check if all required data is entered. The controls in WpfWindowsLib detect themselves if there was a change and inform the window automatically.

Data Entry Samples Application

The project Samples shows the various controls available and demonstrates how the user will interact with them:

Samples

There are 3 columns. The first shows controls with no data, the second controls with no data, but the user has to fill in some data because they are required for saving (note the different background color) and the third column shows controls with some initial data.

The Save button gets only enabled once the user has entered some data for all required controls. If he tries to close the window before doing so, a warning message gets displayed. If everything is saved, but 1 control gets changed again, the same thing happens. The user needs to save before he can close the window.

User has changed data, cannot close window

A warning message shows him which data has changed and asks if he really wants to lose that change by closing or save it by clicking the Save button. This warning message can be surpressed by setting CheckedWindow.IsNoCheckOnCLosing = true.

Coding

To support automatic detection of changes and autoregistration to the host window, a control can use IChecker, which implements the ICheck functionality. It can then be placed in a Window inheriting from CheckedWindow. The initial value and setting IsRequired is done from XAML or code behind:

RequiredDecimalTextBox.Initialise(1.23, isRequired: true);

The controls using IChecker will automatically search for the parent CheckedWindow, register with it and inform it if their HasChanged or IsAvailable property (true if the user has entered a value in a required control) has changed. CheckedWindow checks all other controls and calls OnICheckChangedor OnIsAvailableChanged as needed.

Further documentation

For a more detailed documentation see: CodeProject: Base WPF Window Functionality for Data Entry

Build requirements

.Net Core 3.1 or later

Structure WpfWindowsLib Solution

WpfWindowsLib

The only library needed to be referenced from other code, providing ICheck, IChecker and various WPF controls like TextBox or ComboBox supporting ICheck.

Samples

WPF Core application showing all WpfWindowsLib Controls

WpfWindowsLibTest

WpfWindowsLib unit tests

Project Status

Completed and stable

Copyright

Copyright 2020 Jürg Peter Huber, Singapore.

Licensed under the Creative Commons 0 license

About

WPF Controls for data entry, detecting if required data is missing or data has been changed

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages