Since version 0.1.3.2, Settings are typed, this guide is still relevant, but syntax might vary.
Name- A unique id, that allows identifying the setting and share values between toolbars.
Value- A result value of the setting.
SettingControl- UI part of Setting, a WPF Control.
Label(optional) - Label for Setting, appears on the left from the control
Here is a list of some of the pre-built settings ready to use, for a full list, check out source code
BoolSetting- Boolean Checkbox
ColorSetting- Pop-up(Portable) color picker
DropdownSetting- ComboBox with array of string values
FloatSetting- A TextBox that accepts floating precision values
SizeSetting- A TextBox that accepts integers (Size in pixels), adds "px" at the end of edit (Value is still integer)
You can add
setting to Toolbar as described in this guide and it will be ready to use.
Creating a Setting is not a hard task, but can be tricky sometimes.
Let's get a simple example from source code.
As you can see, a
Name as a parameter. It's good to pass a label as an optional one. We are providing transparent color as a default
Value and generating
The tricky part is in generating Control since you must bind correct values.
In this example, we are binding "Value" (the Setting property) to the PortableColorPicker
SelectedColorProperty. Usually, the principle is the same for most controls, but sometimes you might want to bind more things, check out other source code files for more reference.
The settings are a very comfortable way for easily setting up the tool values, Toolbar system takes care of getting the values and managing them. Building a Setting is easy but requires a bit of setup.