Skip to content

SelectPanel

JaykeBird edited this page Feb 21, 2023 · 12 revisions

Back to home | Back to Reference | View raw text

SelectPanel class

Description

A ListBox-like control that can be used to select and interact with multiple items, with extra functionality and a visual style that matches the rest of the Solid Shine UI controls.

Diagram

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

Members

Properties

Public properties

Type Name Methods
bool AllowParentScrolling
Set whether the SelectPanel should allow its parent to scroll if the SelectPanel doesn't need to scroll. Note that enabling this may disable any child items from scrolling.
get, set
Brush Background
Get or set the brush used for the background of this control.
get, set
Brush BorderBrush
Get or set the brush used for the border around this control.
get, set
Brush BorderDisabledBrush
Get or set the brush used for the border when this control is disabled.
get, set
Thickness BorderThickness
Get or set the thickness of the border around this control.
get, set
Brush ClickBrush
Get or set the brush used when an item in this control is being clicked.
get, set
ColorScheme ColorScheme
Get or set the color scheme to apply to the control. The color scheme can quickly apply a whole visual style to your control.
get, set
CornerRadius CornerRadius
Get or set the corner radius (or radii) to use for the control's border. Setting the corners to 0 means there is no rounding; square corners are used.
Any corners with a higher number will be rounded.
get, set
int Count
Gets the number of items in this SelectPanel.
Note that this function will be removed in a future version. Please instead use Items.Count .
get
Brush DisabledBrush
Get or set the brush used for the background when this control is disabled.
get, set
Brush HighlightBrush
Get or set the brush used when an item in this control is highlighted (i.e. has the mouse over it or has keyboard focus).
get, set
ScrollBarVisibility HorizontalScrollBarVisibility
Get or set the appearance of the horizontal scroll bar for this control.
get, set
SelectableUserControl Item get
SelectableCollection<SelectableUserControl> Items
Get or set the list of items in this SelectPanel. This Items property can be used to add items, remove items, and also select items via the Select method.
get
IEnumerable<SelectableUserControl> ItemsSource
Gets or sets a collection used to generate the content of this SelectPanel.
get, set
bool MultiSelect
Get or set if multiple items can be selected at once. If false, then only 1 item can be selected at a time.
get, set
Brush SelectedBrush
Get or set the brush used when an item in this control is selected.
get, set
int SelectionCount
Gets the number of items that are currently selected.
Note that this function will be removed in a future version. Please instead use Items.SelectedItems.Count .
get
bool UseLighterBorder
Use a lighter border color when applying color schemes. Note that this does not apply in high-contrast mode,
nor does it apply if you are not using color schemes to set this control's appearance.
get, set
ScrollBarVisibility VerticalScrollBarVisibility
Get or set the appearance of the vertical scroll bar for this control.
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 AddItem(SelectableUserControl item)
Add an item to this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Add .
void AddItems(IEnumerable<SelectableUserControl> items)
void ApplyColorScheme(ColorScheme cs, bool useLighterBorder)
Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.
void Clear()
Clear all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Clear .
void DeselectAll()
Deselect all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.ClearSelection .
SelectableUserControl Get(int index)
Get an item at a specified index in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items[] .
IEnumerable<T> GetItemsAsType()
IEnumerable<T> GetSelectedItemsOfType()
int IndexOf(SelectableUserControl item)
Get the index of an item in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.IndexOf .
void InsertItem(int index, SelectableUserControl item)
Insert an item into this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Insert .
void InsertItems(int index, IEnumerable<SelectableUserControl> items)
void MoveItemDown(int index)
Move an item in the SelectPanel down by one position in the list.
void MoveItemUp(int index)
Move an item in the SelectPanel up by one position in the list.
void MoveSelectedItemsDown()
Move the currently selected items down by one in the list.
void MoveSelectedItemsUp()
Move the currently selected items up by one in the list.
void RemoveAt(int index)
Remove an item at a specified index from this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.RemoveAt .
void RemoveItem(SelectableUserControl item)
Remove an item from this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Remove .
void RemoveItems(IEnumerable<SelectableUserControl> items)
void RemoveSelectedItems()
Remove the currently selected items from the list.
void SelectAll()
Select all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.SelectAll .

Details

Summary

A ListBox-like control that can be used to select and interact with multiple items, with extra functionality and a visual style that matches the rest of the Solid Shine UI controls.

Inheritance

  • Control

Constructors

SelectPanel

public SelectPanel()
Summary

Create a new NewSelectPanel.

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, bool useLighterBorder)
Arguments
Type Name Description
ColorScheme cs The color scheme to apply.
bool useLighterBorder Set if a lighter border color should be used.
Summary

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

GetSelectedItemsOfType

public IEnumerable<T> GetSelectedItemsOfType<T>()
where T : SelectableUserControl

SelectAll

public void SelectAll()
Summary

Select all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.SelectAll .

DeselectAll

public void DeselectAll()
Summary

Deselect all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.ClearSelection .

AddItem

public void AddItem(SelectableUserControl item)
Arguments
Type Name Description
SelectableUserControl item Item to be added.
Summary

Add an item to this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Add .

AddItems

public void AddItems(IEnumerable<SelectableUserControl> items)
Arguments
Type Name Description
IEnumerable<SelectableUserControl> items

InsertItem

public void InsertItem(int index, SelectableUserControl item)
Arguments
Type Name Description
int index The index to insert the item at.
SelectableUserControl item The item to insert.
Summary

Insert an item into this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Insert .

InsertItems

public void InsertItems(int index, IEnumerable<SelectableUserControl> items)
Arguments
Type Name Description
int index
IEnumerable<SelectableUserControl> items

GetItemsAsType

public IEnumerable<T> GetItemsAsType<T>()
where T : SelectableUserControl

RemoveItem

public void RemoveItem(SelectableUserControl item)
Arguments
Type Name Description
SelectableUserControl item The item to be removed.
Summary

Remove an item from this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Remove .

RemoveItems

public void RemoveItems(IEnumerable<SelectableUserControl> items)
Arguments
Type Name Description
IEnumerable<SelectableUserControl> items

RemoveAt

public void RemoveAt(int index)
Arguments
Type Name Description
int index The index of the item to be removed.
Summary

Remove an item at a specified index from this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.RemoveAt .

RemoveSelectedItems

public void RemoveSelectedItems()
Summary

Remove the currently selected items from the list.

Remarks

Note: unlike many other functions, this one is not being removed in a near future version.

IndexOf

public int IndexOf(SelectableUserControl item)
Arguments
Type Name Description
SelectableUserControl item The item to get the index of.
Summary

Get the index of an item in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.IndexOf .

Get

public SelectableUserControl Get(int index)
Arguments
Type Name Description
int index The index of the item to be removed.
Summary

Get an item at a specified index in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items[] .

Clear

public void Clear()
Summary

Clear all items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Clear .

MoveSelectedItemsUp

public void MoveSelectedItemsUp()
Summary

Move the currently selected items up by one in the list.

MoveSelectedItemsDown

public void MoveSelectedItemsDown()
Summary

Move the currently selected items down by one in the list.

Remarks

This function does not operate if the ItemsSource is set to a different collection.

MoveItemUp

public void MoveItemUp(int index)
Arguments
Type Name Description
int index The index of the item to move.
Summary

Move an item in the SelectPanel up by one position in the list.

Remarks

If the index passed in is 0, then nothing is moved, as it's already at the top of the list. This function does not operate if the ItemsSource is set to a different collection.

Exceptions
Name Description
ArgumentOutOfRangeException Thrown if the index passed in is beyond the number of items in the collection.

MoveItemDown

public void MoveItemDown(int index)
Arguments
Type Name Description
int index The index of the item to move.
Summary

Move an item in the SelectPanel down by one position in the list.

Remarks

If the index passed in is the last index in the collection, then nothing is moved, as it's already at the bottom of the list. This function does not operate if the ItemsSource is set to a different collection.

Exceptions
Name Description
ArgumentOutOfRangeException Thrown if the index passed in is beyond the number of items in the collection.

Properties

ItemsSource

public IEnumerable<SelectableUserControl> ItemsSource { get; set; }
Summary

Gets or sets a collection used to generate the content of this SelectPanel.

Remarks

It is recommended to set this property to an ObservableCollection<ModularDoc.Elements.Markdown.TextElement> , SelectableCollection<T> , or SelectableCollectionView<T> . If you use other IEnumerable types that do not also implement INotifyCollectionChanged , then this control's contents will not update automatically. If you do not use a SelectableCollection or SelectableCollectionView, you may also need to implement your own code for handling the selection state of the items in your collection.

Items

public SelectableCollection<SelectableUserControl> Items { get; }
Summary

Get or set the list of items in this SelectPanel. This Items property can be used to add items, remove items, and also select items via the Select method.

MultiSelect

public bool MultiSelect { get; set; }
Summary

Get or set if multiple items can be selected at once. If false, then only 1 item can be selected at a time.

ColorScheme

public ColorScheme ColorScheme { get; set; }
Summary

Get or set the color scheme to apply to the control. The color scheme can quickly apply a whole visual style to your control.

UseLighterBorder

public bool UseLighterBorder { get; set; }
Summary

Use a lighter border color when applying color schemes. Note that this does not apply in high-contrast mode, nor does it apply if you are not using color schemes to set this control's appearance.

HorizontalScrollBarVisibility

public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
Summary

Get or set the appearance of the horizontal scroll bar for this control.

VerticalScrollBarVisibility

public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Summary

Get or set the appearance of the vertical scroll bar for this control.

Background

public Brush Background { get; set; }
Summary

Get or set the brush used for the background of this control.

ClickBrush

public Brush ClickBrush { get; set; }
Summary

Get or set the brush used when an item in this control is being clicked.

SelectedBrush

public Brush SelectedBrush { get; set; }
Summary

Get or set the brush used when an item in this control is selected.

HighlightBrush

public Brush HighlightBrush { get; set; }
Summary

Get or set the brush used when an item in this control is highlighted (i.e. has the mouse over it or has keyboard focus).

DisabledBrush

public Brush DisabledBrush { get; set; }
Summary

Get or set the brush used for the background when this control is disabled.

BorderDisabledBrush

public Brush BorderDisabledBrush { get; set; }
Summary

Get or set the brush used for the border when this control is disabled.

BorderBrush

public Brush BorderBrush { get; set; }
Summary

Get or set the brush used for the border around this control.

BorderThickness

public Thickness BorderThickness { get; set; }
Summary

Get or set the thickness of the border around this control.

CornerRadius

public CornerRadius CornerRadius { get; set; }
Summary

Get or set the corner radius (or radii) to use for the control's border. Setting the corners to 0 means there is no rounding; square corners are used. Any corners with a higher number will be rounded.

Count

public int Count { get; }
Summary

Gets the number of items in this SelectPanel. Note that this function will be removed in a future version. Please instead use Items.Count .

SelectionCount

public int SelectionCount { get; }
Summary

Gets the number of items that are currently selected. Note that this function will be removed in a future version. Please instead use Items.SelectedItems.Count .

Item

public SelectableUserControl Item { get; }

AllowParentScrolling

public bool AllowParentScrolling { get; set; }
Summary

Set whether the SelectPanel should allow its parent to scroll if the SelectPanel doesn't need to scroll. Note that enabling this may disable any child items from scrolling.

Events

ColorSchemeChanged

public event DependencyPropertyChangedEventHandler ColorSchemeChanged
Summary

Raised when the ColorScheme property is changed.

SelectionChanged

public event SelectionChangedEventHandler SelectionChanged
Summary

Raised when an item is selected or deselected in this list.

ItemsAdded

public event SelectionChangedEventHandler ItemsAdded
Summary

Raised when an item is added to this list.

ItemsRemoved

public event SelectionChangedEventHandler ItemsRemoved
Summary

Raised when an item is removed from this list.

Generated with ModularDoc

Clone this wiki locally