Skip to content

CheckBox

JaykeBird edited this page Feb 21, 2023 · 10 revisions

Back to home | Back to Reference | View raw text

CheckBox class

Description

A CheckBox control with more customization over the appearance, and a larger box for a more touch-friendly UI.

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi
  SolidShineUi.CheckBox[[CheckBox]]
  end
  subgraph System.Windows.Controls
System.Windows.Controls.ContentControl[[ContentControl]]
  end
System.Windows.Controls.ContentControl --> SolidShineUi.CheckBox
Loading

Members

Properties

Public properties

Type Name Methods
Brush BackgroundDisabledBrush
Get or set the brush to use for the background of the checkbox's box when it is disabled.
get, set
Brush BorderBrush
Get or set the brush used for the border of the checkbox's box.
get, set
Brush BorderDisabledBrush
Get or set the brush used for the border of the checkbox's box when it is disabled.
get, set
Brush BorderHighlightBrush
Get or set the brush used for the border of the checkbox's box, while the mouse is over the control or it has keyboard focus.
get, set
Thickness BorderSelectionThickness
Get or set the thickness of the border of the check box, while the check box's IsChecked property is true.
get, set
Thickness BorderThickness
Get or set the thickness of the border of the check box.
get, set
Brush CheckBackground
Get or set the brush used for the background of the checkbox's box. This is not set via a color scheme.
get, set
Brush CheckDisabledBrush
Get or set the brush used for the check mark when the control is disabled.
get, set
Brush CheckForeground
Get or set the brush used for the check mark in the checkbox's box.
get, set
CheckState CheckState
Get or set the state of the checkbox, via a CheckState enum. Can be set via this property or via the IsChecked and IsIndeterminate properties.
get, set
bool ClickOnPress
Gets or sets whether the Click event should be raised when the checkbox is pressed, rather than when it is released.
get, set
ColorScheme ColorScheme
Get or set the color scheme used for this checkbox. For easier color scheme management, bind this to the window or larger control you're using.
get, set
CornerRadius CornerRadius
Get or set the corner radius of the check box.
get, set
bool IsChecked
Get or set if the check box is checked. (Note: if in the Indeterminate state, it will still return true as checked.)
get, set
bool IsIndeterminate
Get or set if the check box is in the Indeterminate state.
get, set
bool OnlyAllowCheckBoxClick
Gets or sets whether clicking should only occur when the checkbox's box is clicked, and not the rest of the control.
get, set
bool TriStateClick
Gets or sets whether the checkbox should cycle through three states (rather than two) when clicked. The third state is the "Indeterminate" state, which can be checked via the IsIndeterminate property.
get, set

Methods

Public Static methods

Returns Name
void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Perform an action when the ColorScheme property has changed. Primarily used internally.

Public methods

Returns Name
void ApplyColorScheme(ColorScheme cs)
Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.
void DoClick()
Perform a click programattically. The checkbox responds the same way as if it was clicked by the user.

Details

Summary

A CheckBox control with more customization over the appearance, and a larger box for a more touch-friendly UI.

Inheritance

  • ContentControl

Constructors

CheckBox

public CheckBox()
Summary

Create a new CheckBox control.

Methods

OnColorSchemeChanged

public static void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Arguments
Type Name Description
DependencyObject d The object containing the property that changed.
DependencyPropertyChangedEventArgs e Event arguments about the property change.
Summary

Perform an action when the ColorScheme property has changed. Primarily used internally.

ApplyColorScheme

public void ApplyColorScheme(ColorScheme cs)
Arguments
Type Name Description
ColorScheme cs The color scheme to apply.
Summary

Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.

DoClick

public void DoClick()
Summary

Perform a click programattically. The checkbox responds the same way as if it was clicked by the user.

Properties

IsChecked

public bool IsChecked { get; set; }
Summary

Get or set if the check box is checked. (Note: if in the Indeterminate state, it will still return true as checked.)

IsIndeterminate

public bool IsIndeterminate { get; set; }
Summary

Get or set if the check box is in the Indeterminate state.

CheckState

public CheckState CheckState { get; set; }
Summary

Get or set the state of the checkbox, via a CheckState enum. Can be set via this property or via the IsChecked and IsIndeterminate properties.

ColorScheme

public ColorScheme ColorScheme { get; set; }
Summary

Get or set the color scheme used for this checkbox. For easier color scheme management, bind this to the window or larger control you're using.

CheckBackground

public Brush CheckBackground { get; set; }
Summary

Get or set the brush used for the background of the checkbox's box. This is not set via a color scheme.

CheckForeground

public Brush CheckForeground { get; set; }
Summary

Get or set the brush used for the check mark in the checkbox's box.

BackgroundDisabledBrush

public Brush BackgroundDisabledBrush { get; set; }
Summary

Get or set the brush to use for the background of the checkbox's box when it is disabled.

BorderDisabledBrush

public Brush BorderDisabledBrush { get; set; }
Summary

Get or set the brush used for the border of the checkbox's box when it is disabled.

CheckDisabledBrush

public Brush CheckDisabledBrush { get; set; }
Summary

Get or set the brush used for the check mark when the control is disabled.

BorderBrush

public Brush BorderBrush { get; set; }
Summary

Get or set the brush used for the border of the checkbox's box.

BorderHighlightBrush

public Brush BorderHighlightBrush { get; set; }
Summary

Get or set the brush used for the border of the checkbox's box, while the mouse is over the control or it has keyboard focus.

BorderThickness

public Thickness BorderThickness { get; set; }
Summary

Get or set the thickness of the border of the check box.

BorderSelectionThickness

public Thickness BorderSelectionThickness { get; set; }
Summary

Get or set the thickness of the border of the check box, while the check box's IsChecked property is true.

CornerRadius

public CornerRadius CornerRadius { get; set; }
Summary

Get or set the corner radius of the check box.

ClickOnPress

public bool ClickOnPress { get; set; }
Summary

Gets or sets whether the Click event should be raised when the checkbox is pressed, rather than when it is released.

TriStateClick

public bool TriStateClick { get; set; }
Summary

Gets or sets whether the checkbox should cycle through three states (rather than two) when clicked. The third state is the "Indeterminate" state, which can be checked via the IsIndeterminate property.

OnlyAllowCheckBoxClick

public bool OnlyAllowCheckBoxClick { get; set; }
Summary

Gets or sets whether clicking should only occur when the checkbox's box is clicked, and not the rest of the control.

Events

CheckBoxClick

public event RoutedEventHandler CheckBoxClick
Summary

An event that raises only when the checkbox itself is clicked.

CheckChanged

public event RoutedEventHandler CheckChanged
Summary

Raised when the CheckState property is changed, either to Checked, Indeterminate, or Unchecked.

Checked

public event RoutedEventHandler Checked
Summary

Raised when the CheckState property is changed to Checked.

Unchecked

public event RoutedEventHandler Unchecked
Summary

Raised when the CheckState property is changed to Unchecked.

Indeterminate

public event RoutedEventHandler Indeterminate
Summary

Raised when the CheckState property is changed to Indeterminate.

InternalIsCheckedChanged

protected event DependencyPropertyChangedEventHandler InternalIsCheckedChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

InternalIsIndeterminateChanged

protected event DependencyPropertyChangedEventHandler InternalIsIndeterminateChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

ColorSchemeChanged

public event DependencyPropertyChangedEventHandler ColorSchemeChanged
Summary

Raised when the ColorScheme property is changed.

Click

public event RoutedEventHandler Click
Summary

Raised when the check box is clicked.

RightClick

public event RoutedEventHandler RightClick
Summary

Raised when the check box is right-clicked.

Generated with ModularDoc

Clone this wiki locally