This repo is a demo WPF/WinForms application that focuses on some features of the KGySoft.ComponentModel namespace of KGy SOFT Core Libraries and also provides some useful solutions for using the KGy SOFT Core Libraries in WPF and Windows Forms applications.
- The KGySoft.ComponentModelDemo.Model namespace demonstrates how to use the various business object base types as model classes.
- It contains also some example commands. See more about KGy SOFT's technology agnostic commands and command bindings on the website.
- The KGySoft.ComponentModelDemo.ViewModel namespace demonstrates how to create a technology-agnostic ViewModel. The MainViewModel class is used by a WPF Window and WinForms Form as well.
You can download the sources and the binaries as .zip archives here.
- The KGyCommandAdapter class makes possible to use KGy SOFT commands in WPF as traditional Microsoft commands.
- The EventToCommand markup extension makes possible to create bindings to KGy SOFT commands directly from XAML like this (see the MainWindow.xaml file for more examples):
<Button Content="Click Me" Click="{commands:EventToKGyCommand Command={Binding DoSomethingCommand}}"/>
- The EditToolBar control can be bound to any undoable/editable object. It also demonstrates the usage of the KGyCommandAdapter class.
- The ValidationResult and HasValidationResult markup extensions make possible to obtain/check validation results of IValidatingObject instances directly from XAML like this (see the MainWindow.xaml file for more examples):
<DataTrigger Value="True" Binding="{validation:HasValidationResult Warning,
Path=TestList/ValidationResults,
PropertyName=IntProp}">
- The ElementAdorner.Template attached property can be used to define a template for a UIElement that will be displayed in the adorner layer. This makes possible creating templates for Warning and Information validation levels similarly to WPF's Validation.ErrorTemplate property (see the MainWindow.xaml file for more examples):
<!-- Warning Template -->
<Setter Property="adorners:ElementAdorner.Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="Orange" BorderThickness="3">
<adorners:AdornedElementPlaceholder/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
- The EditMenuStrip control can be bound to any undoable/editable object.
- The ValidationResultToErrorProviderAdapter component can turn an ErrorProvider component to a WarningProvider or InfoProvider. Just drop it on the Windows Forms Designer, and select the provider instance and the severity. If the
DataSource
property provides IValidatingObject instances, then the selected provider will display the validation results of the chosen severity. - The ToolTipUpdater is a command state updater that can sync
ToolTipText
command state forControl
sources if any of their parents have aToolTip
component.
This repository is under the KGy SOFT License 1.0, which is a permissive GPL-like license. It allows you to copy and redistribute the material in any medium or format for any purpose, even commercially. The only thing is not allowed is to distribute a modified material as yours: though you are free to change and re-use anything, do that by giving appropriate credit. See the LICENSE file for details.