Models
These classes ease the widget development providing ready to use solutions for custom settings.
- Model base
- Described exception
- Widget thickness
- Widget uniform thickness
- Widget corner radius
- Widget border
- Widget background
Model base
This is a base class of all models that need the OnPropertyChanged method.
Methods
| Name | Parameters | Description | Returns |
|---|---|---|---|
SetProperty | ref T property, T value, [CallerMemberName] string propertyName = null | It sets the new value to a property and calls the OnPropertyChanged method. | void |
Usage
This example shows the usage of the SetProperty method.
C#
public class MyClass : ModelBase
{
[JsonIgnore]
private Color _color { get; set; } = Color.FromArgb(255, 255, 255, 255);
public Color Color
{
get => _color;
set => SetProperty(ref _color, Color);
}
}Described exception
This class is used to add a custom message to an exception.
Constructor
C#
public DescribedException(Exception exception, string description) { ... }Properties
| Name | Type | Description | Default |
|---|---|---|---|
Description | string | Custom description. | null |
Exception | Exception | Exception that occured. | null |
Usage
C#
new DescribedException(exception: Exception, description: "Custom description.");Widget thickness
This class is used to wrap Thickness into a JSON saveable class.
Constructor
C#
public WidgetThickness(int thickness) { ... }
public WidgetThickness(int left, int top, int right, int bottom) { ... }Properties
| Name | Type | Description | Default |
|---|---|---|---|
Get | Thickness | Returns Thickness. | new Thickness(Left, Top, Right, Bottom); |
Left | int | Left margin. | 0 |
Top | int | Top margin. | 0 |
Right | int | Right margin. | 0 |
Bottom | int | Bottom margin. | 0 |
Usage
C#
new WidgetThickness(thickness: 24); // All sides
new WidgetThickness(left: 8, top: 16, right: 8, bottom: 16);Widget uniform thickness
This class derives from WidgetThickness. Each side of this thickness has the same margin.
Constructor
C#
public WidgetUniformThickness(int thickness) { ... }Properties
| Name | Type | Description | Default |
|---|---|---|---|
Value | Thickness | Uniform margin value. | 0 |
Get | Thickness | Returns Thickness. | new Thickness(Value); |
Left | int | Left margin. | 0 |
Top | int | Top margin. | 0 |
Right | int | Right margin. | 0 |
Bottom | int | Bottom margin. | 0 |
Usage
C#
new WidgetUniformThickness(thickness: 24); // All sidesWidget corner radius
This class is used to wrap CornerRadius into a JSON saveable class.
Constructor
C#
public WidgetCornerRadius(int cornerRadius) { ... }Properties
| Name | Type | Description | Default |
|---|---|---|---|
Radius | int | Uniform corner radius value. | 0 |
Corners | CornerRadius | Returns CornerRadius. | new CornerRadius(Corners); |
Usage
C#
new WidgetCornerRadius(cornerRadius: 8);Widget border
This class is used to store data about widget's border.
Properties
| Name | Type | Description | Default |
|---|---|---|---|
Color | Color | Speficies the color of the border. | Color.FromArgb(255, 0, 0, 0); |
Thickness | WidgetUniformThickness | Specifies the WidgetUniformThickness to use for the border. | new WidgetUniformThickness(0); |
Usage
C#
new WidgetBorder();Widget background
This class is used to store data about widget's background.
Properties
| Name | Type | Description | Default |
|---|---|---|---|
Color | Color | Speficies the color of the background. | Color.FromArgb(255, 0, 0, 0); |
Usage
C#
new WidgetBackground();