The ReadOnly state that was introduced in Wisej 1.5.4. No Styles or Properties are defined in the standard theme files, as different people have different views on how a ReadOnly control should look like. This example shows how to do a mixin to define how a ReadOnly control will look.
A mixin is a partial theme definition. It extends or overrides the application theme, no matter what theme is used by the application
A mixin file must be named <arbitrary_mixin_name>.mixin.theme and must in the /Themes folder. The Build Action can be set to Embedded Resource, None or Content. This project uses the later option.
Even if the theme or mixin files are an Embedded Resource, you don't need to recompile the application to change them. To override a theme or mixin files on runtime, just change the files in the /Themes folder.
Embedded themes and mixins in other assemblies are loaded only when the [assembly:WisejResources] attribute is present in AssemblyInfo.cs file.
A mixin must be created in Visual Studio and it may be edited in the ThemeBuilder. Please refer to Edit Mixins on Wisej Documentation.
The ReadOnly state is supported on the following controls:
- TextBox
- ComboBox
- DateTimePicker
- ListBox
- DomainUpDown
- NumericUpDown
This project defines an opacity property of 0.5 for the ReadOnly state. This means a ReadOnly control looks just like a Disabled control. The main difference is that, on most controls, you can't select the contents of a Disabled control, but you can select the contents of a ReadOnly control.
The file ReadOnly.mixin.theme is worth your attention, specially if you plan to customize a theme file.
-
Appearance names are case sensitive.
-
We intend to override how a Control or Component looks, its appearance. To override an appearance, we must use the same appearance name. To use most theme atributes for this appearance, we must "inherit" and specify the same appearance name again.
-
ThemeBuilder shows the appearance name with the first letter in upper case. If you want ThemeBuilder to show ComboBox (upper case "B"), you must use the "text" key.
-
The appearance name doesn't always match the control name. The appearance name for the ListBox control is "list". Use ThemeBuilder to find the appearance name for each control. Again, use the "text" key to show a different name on ThemeBuilder.
-
An appearance name may be shared by several controls. The appearance name "spinner" is used by DomainUpDown and NumericUpDown controls.
-
Last note, to use custom names like “My-ComboBox”, you have the to explicitly set the control’s AppearanceKey on the Properties property grid or programmatically like this:
this.comboBox.AppearanceKey = "My-ComboBox";