Skip to content

Demo WPF/WinForms app for the KGySoft.ComponentModel namespace of the KGy SOFT Core Libraries

License

Notifications You must be signed in to change notification settings

koszeggy/KGySoft.ComponentModelDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KGy SOFT .net

KGySoft.ComponentModelDemo

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.

Website Online Help CoreLibraries Repo

KGySoft.ComponentModelDemo

Table of Contents

  1. A few highlights
  2. Download
  3. Useful WPF Components
  4. Useful Windows Forms Components
  5. License

A few highlights:

Download

You can download the sources and the binaries as .zip archives here.

Useful WPF Components

  • 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}}"/>
<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>

Useful Windows Forms Components

  • 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 for Control sources if any of their parents have a ToolTip component.

License

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.