Skip to content

SelectableItem

JaykeBird edited this page Feb 21, 2023 · 10 revisions

Back to home | Back to Reference | View raw text

SelectableItem class

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi
  SolidShineUi.SelectableItem[[SelectableItem]]
  SolidShineUi.SelectableUserControl[[SelectableUserControl]]
  end
  subgraph System.Windows.Markup
System.Windows.Markup.IComponentConnector[[IComponentConnector]]
  end
System.Windows.Markup.IComponentConnector --> SolidShineUi.SelectableItem
SolidShineUi.SelectableUserControl --> SolidShineUi.SelectableItem
Loading

Members

Properties

Public properties

Type Name Methods
bool AllowTextEditing
Get or set whether the user should be allowed to edit the text in the Text property. If enabled, a text box will appear when the user clicks on the text.
get, set
bool AutoShowImageOnSourceSet
Get or set whether the ShowImage property should be updated when the ImageSource property is set. Default is true.
get, set
CheckState CheckboxState
Get or set the state of the checkbox. The checkbox is only shown if SelectableItem.ShowCheckbox is set to true.
get, set
ImageSource ImageSource
Get or set the source for the image to show on the left side of the item. If set, the item automatically displays the image (unless AutoShowImageOnSourceSet is set to false).
get, set
double ImageWidth
Get or set the width to afford to the image. By default, the width is set to 16, but larger images will require the width to be set higher.
get, set
double Indent
Get or set the left indent to apply to the item's content. This can be used to make an improvised tree view.
get, set
bool IsCheckboxChecked
Get or set if the checkbox is checked. The checkbox is only shown if SelectableItem.ShowCheckbox is set to true.
get, set
bool MatchCheckboxValueToSelect
Get or set if the checkbox's value should be changed if this control is selected (and vice-versa). Default is true
get, set
FontFamily RightFontFamily
Get or set the FontFamily to use for the text on the right side of the control.
get, set
double RightFontSize
Get or set the font size to use for the text on the right side of the control.
get, set
FontStretch RightFontStretch
Get or set the font stretch to use for the text on the right side of the control.
get, set
FontStyle RightFontStyle
Get or set the FontStyle to use for the text on the right side of the control.
get, set
FontWeight RightFontWeight
Get or set the font weight to use for the text on the right side of the control.
get, set
string RightText
Get or set the text to display on the far-right side of the item. This text cannot be edited directly by the user.
get, set
GridLength RightTextWidth
Get or set the width of the right text section of the control.
This can be used to limit the width of the right text section, or make it as wide as needed for the right text to fit fully.
get, set
bool SelectOnFocusTextEdit
Get or set whether all of the text should be selected when the text-editing text box recieves focus.
get, set
bool ShowCheckbox
Get or set whether a checkbox should be displayed on the item. Checkboxes can make it easy to select mutliple items.
get, set
bool ShowImage
Get or set whether to display an image on the left side of the item. Set the image via the ImageSource property.
get, set
string Text
Get or set the text to display within the item. This text can be edited by setting AllowTextEditing to true, or by calling SelectableItem.DisplayEditText .
get, set
GridLength TextColumnWidth
Get or set the width of the main text section of the control.
This can be used to limit the width of the main text section, or make it as wide as needed for the full text to fit.
get, set
TextTrimming TextTrimming
Get or set the text trimming behavior to use when the text overflows the visible area.
get, set
bool TextUnderlineOnMouseOver
Get or set if the text should have an underline effect when the mouse is over the text. This is enabled by default when AllowTextEditing is set to "true", but otherwise is disabled.
get, set

Methods

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 CancelEdit()
Cancel the user's edit to the text and exits the text editing view (if in the view). This can be called at any time.
void ConfirmEdit()
Confirm the user's edit to the text, as changed via the text editing view. Also exits the text editing view. This can only be called when in the text editing view.
void DisplayEditText()
Display the text editing view to the user. This is the same as the user clicking on the text while AllowTextEditing is set to true.
void InitializeComponent()
InitializeComponent

Internal methods

Returns Name
Delegate _CreateDelegate(Type delegateType, string handler)

Details

Inheritance

Constructors

SelectableItem [1/3]

public SelectableItem()
Summary

Create a SelectableItem to use with a SelectPanel.

SelectableItem [2/3]

public SelectableItem(string text)
Arguments
Type Name Description
string text The text to display in the item.
Summary

Create a SelectableItem to use with a SelectPanel, with the text preset.

SelectableItem [3/3]

public SelectableItem(string text, ImageSource image, double indent)
Arguments
Type Name Description
string text The text to display in the item.
ImageSource image The image to display in the item. (If the image is wider than 16 pixels, you may need to update the ImageWidth property.) Set to null to not show an image.
double indent The left indent to apply to the item's content. The indent can be used to make an improvised tree view.
Summary

Create a SelectableItem to use with a SelectPanel, with certain properties preset.

Methods

ApplyColorScheme

public override 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.

DisplayEditText

public void DisplayEditText()
Summary

Display the text editing view to the user. This is the same as the user clicking on the text while AllowTextEditing is set to true.

Remarks

This method will activate the text editing view even if AllowTextEditing is set to false.

ConfirmEdit

public void ConfirmEdit()
Summary

Confirm the user's edit to the text, as changed via the text editing view. Also exits the text editing view. This can only be called when in the text editing view.

Exceptions
Name Description
InvalidOperationException Thrown if this item is not in the text editing view.

CancelEdit

public void CancelEdit()
Summary

Cancel the user's edit to the text and exits the text editing view (if in the view). This can be called at any time.

InitializeComponent

public virtual void InitializeComponent()
Summary

InitializeComponent

_CreateDelegate

internal Delegate _CreateDelegate(Type delegateType, string handler)
Arguments
Type Name Description
Type delegateType
string handler

Properties

Indent

public double Indent { get; set; }
Summary

Get or set the left indent to apply to the item's content. This can be used to make an improvised tree view.

ShowCheckbox

public bool ShowCheckbox { get; set; }
Summary

Get or set whether a checkbox should be displayed on the item. Checkboxes can make it easy to select mutliple items.

CheckboxState

public CheckState CheckboxState { get; set; }
Summary

Get or set the state of the checkbox. The checkbox is only shown if SelectableItem.ShowCheckbox is set to true.

IsCheckboxChecked

public bool IsCheckboxChecked { get; set; }
Summary

Get or set if the checkbox is checked. The checkbox is only shown if SelectableItem.ShowCheckbox is set to true.

MatchCheckboxValueToSelect

public bool MatchCheckboxValueToSelect { get; set; }
Summary

Get or set if the checkbox's value should be changed if this control is selected (and vice-versa). Default is true

ImageWidth

public double ImageWidth { get; set; }
Summary

Get or set the width to afford to the image. By default, the width is set to 16, but larger images will require the width to be set higher.

ShowImage

public bool ShowImage { get; set; }
Summary

Get or set whether to display an image on the left side of the item. Set the image via the ImageSource property.

ImageSource

public ImageSource ImageSource { get; set; }
Summary

Get or set the source for the image to show on the left side of the item. If set, the item automatically displays the image (unless AutoShowImageOnSourceSet is set to false).

AutoShowImageOnSourceSet

public bool AutoShowImageOnSourceSet { get; set; }
Summary

Get or set whether the ShowImage property should be updated when the ImageSource property is set. Default is true.

Text

public string Text { get; set; }
Summary

Get or set the text to display within the item. This text can be edited by setting AllowTextEditing to true, or by calling SelectableItem.DisplayEditText .

TextColumnWidth

public GridLength TextColumnWidth { get; set; }
Summary

Get or set the width of the main text section of the control. This can be used to limit the width of the main text section, or make it as wide as needed for the full text to fit.

TextTrimming

public TextTrimming TextTrimming { get; set; }
Summary

Get or set the text trimming behavior to use when the text overflows the visible area.

RightText

public string RightText { get; set; }
Summary

Get or set the text to display on the far-right side of the item. This text cannot be edited directly by the user.

RightFontFamily

public FontFamily RightFontFamily { get; set; }
Summary

Get or set the FontFamily to use for the text on the right side of the control.

RightFontSize

public double RightFontSize { get; set; }
Summary

Get or set the font size to use for the text on the right side of the control.

RightFontWeight

public FontWeight RightFontWeight { get; set; }
Summary

Get or set the font weight to use for the text on the right side of the control.

RightFontStretch

public FontStretch RightFontStretch { get; set; }
Summary

Get or set the font stretch to use for the text on the right side of the control.

RightFontStyle

public FontStyle RightFontStyle { get; set; }
Summary

Get or set the FontStyle to use for the text on the right side of the control.

RightTextWidth

public GridLength RightTextWidth { get; set; }
Summary

Get or set the width of the right text section of the control. This can be used to limit the width of the right text section, or make it as wide as needed for the right text to fit fully.

TextUnderlineOnMouseOver

public bool TextUnderlineOnMouseOver { get; set; }
Summary

Get or set if the text should have an underline effect when the mouse is over the text. This is enabled by default when AllowTextEditing is set to "true", but otherwise is disabled.

SelectOnFocusTextEdit

public bool SelectOnFocusTextEdit { get; set; }
Summary

Get or set whether all of the text should be selected when the text-editing text box recieves focus.

AllowTextEditing

public bool AllowTextEditing { get; set; }
Summary

Get or set whether the user should be allowed to edit the text in the Text property. If enabled, a text box will appear when the user clicks on the text.

Remarks

While editing, pressing "Enter" will confirm the edit, while pressing "Escape" will cancel the operation.

Events

TextChanged

public event RoutedPropertyChangedEventHandler<string> TextChanged
Summary

Raised when the Text property is changed, either via updating the property or via the the user's text editing view.

Generated with ModularDoc

Clone this wiki locally