Class Accordion
Represents a collection of collapsed and expanded AccordionItem controls.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: Controls.Layout.Toolkit.OpenSilver.dll
Syntax
public class Accordion : ItemsControl
Constructors
| Improve this Doc View SourceAccordion()
Initializes a new instance of the Accordion class.
Declaration
public Accordion()
Fields
| Improve this Doc View SourceAccordionButtonStyleProperty
Identifies the AccordionButtonStyle dependency property.
Declaration
public static readonly DependencyProperty AccordionButtonStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ContentTemplateProperty
Identifies the ContentTemplate dependency property.
Declaration
public static readonly DependencyProperty ContentTemplateProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ExpandDirectionProperty
Identifies the ExpandDirection dependency property.
Declaration
public static readonly DependencyProperty ExpandDirectionProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ItemContainerStyleProperty
Identifies the ItemContainerStyle dependency property.
Declaration
public static readonly DependencyProperty ItemContainerStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedIndicesProperty
Identifies the SelectedIndices dependency property.
Declaration
public static readonly DependencyProperty SelectedIndicesProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedItemsProperty
Identifies the SelectedItems dependency property.
Declaration
public static readonly DependencyProperty SelectedItemsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectionModeProperty
Identifies the SelectionMode dependency property.
Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectionSequenceProperty
Identifies the SelectionSequence dependency property.
Declaration
public static readonly DependencyProperty SelectionSequenceProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceAccordionButtonStyle
Gets or sets the Style that is applied to AccordionButton elements in the AccordionItems.
Declaration
public Style AccordionButtonStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
ContentTemplate
Gets or sets the DataTemplate used to display the content of each generated AccordionItem.
Declaration
public DataTemplate ContentTemplate { get; set; }
Property Value
Type | Description |
---|---|
DataTemplate |
Remarks
Either ContentTemplate or ItemTemplate is used. Setting both will result in an exception.
ExpandDirection
Gets or sets the ExpandDirection property of each AccordionItem in the Accordion control and the direction in which the Accordion does layout.
Declaration
public ExpandDirection ExpandDirection { get; set; }
Property Value
Type | Description |
---|---|
ExpandDirection |
Remarks
Setting the ExpandDirection will set the expand direction on the accordionItems.
ItemContainerStyle
Gets or sets the Style that is applied to the container element generated for each item.
Declaration
public Style ItemContainerStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
SelectedIndex
Gets or sets the index of the currently selected AccordionItem.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectedIndices
Gets the indices of the currently selected AccordionItems.
Declaration
public IList<int> SelectedIndices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.Int32> |
SelectedItem
Gets or sets the selected item.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Remarks
The default value is null. When multiple items are allowed (IsMaximumOneSelected false), return the first of the selectedItems.
SelectedItems
Gets the selected items.
Declaration
public IList SelectedItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.IList |
Remarks
Does not allow setting.
SelectionMode
Gets or sets the AccordionSelectionMode used to determine the minimum and maximum selected AccordionItems allowed in the Accordion.
Declaration
public AccordionSelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
AccordionSelectionMode |
SelectionSequence
Gets or sets the SelectionSequence used to determine the order of AccordionItem selection.
Declaration
public SelectionSequence SelectionSequence { get; set; }
Property Value
Type | Description |
---|---|
SelectionSequence |
Methods
| Improve this Doc View SourceClearContainerForItemOverride(DependencyObject, Object)
Undoes the effects of the PrepareContainerForItemOverride(DependencyObject, Object) method.
Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The container element. |
System.Object | item | The item that should be cleared. |
GetContainerForItemOverride()
Creates or identifies the element that is used to display the given item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
Type | Description |
---|---|
DependencyObject | The element that is used to display the given item. |
Overrides
| Improve this Doc View SourceIsItemItsOwnContainerOverride(Object)
Determines if the specified item is (or is eligible to be) its own container.
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The item to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the item is (or is eligible to be) its own container; otherwise, false. |
OnApplyTemplate()
Builds the visual tree for the Accordion control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnCreateAutomationPeer()
Returns a AccordionAutomationPeer for use by the Silverlight automation infrastructure.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer | A AccordionAutomationPeer object for the Accordion. |
Overrides
| Improve this Doc View SourceOnGotFocus(RoutedEventArgs)
Provides handling for the GotFocus event.
Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the Items property changes.
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
NotifyCollectionChangedEventArgs | e | Information about the change. |
OnLostFocus(RoutedEventArgs)
Provides handling for the LostFocus event.
Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseEnter(MouseEventArgs)
Provides handling for the MouseEnter event.
Declaration
protected override void OnMouseEnter(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeave(MouseEventArgs)
Provides handling for the MouseLeave event.
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonDown(MouseButtonEventArgs)
Provides handling for the MouseLeftButtonDown event.
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonUp(MouseButtonEventArgs)
Called before the MouseLeftButtonUp event occurs.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnSelectedItemChanged(SelectionChangedEventArgs)
Raises the SelectedItemChanged event when the SelectedItem property value changes.
Declaration
protected virtual void OnSelectedItemChanged(SelectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventArgs | e | The SelectionChangedEventArgs instance containing the event data. |
PrepareContainerForItemOverride(DependencyObject, Object)
Prepares the specified element to display the specified item.
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The element used to display the specified item. |
System.Object | item | The item to display. |
SelectAll()
Selects all the AccordionItems in the Accordion control.
Declaration
public void SelectAll()
Remarks
If the Accordion SelectionMode is OneOrMore or ZeroOrMore all AccordionItems would be selected. If the Accordion SelectionMode is One or ZeroOrOne all items would be selected and unselected. Only the last AccordionItem would remain selected.
UnselectAll()
Unselects all the AccordionItems in the Accordion control.
Declaration
public void UnselectAll()
Remarks
If the Accordion SelectionMode is Zero or ZeroOrMore all
AccordionItems would be Unselected. If SelectionMode is One or
OneOrMode than all items would be Unselected and selected. Only the
first AccordionItem would still be selected.
Events
| Improve this Doc View SourceSelectedItemsChanged
Occurs when the SelectedItems collection changes.
Declaration
public event NotifyCollectionChangedEventHandler SelectedItemsChanged
Event Type
Type | Description |
---|---|
NotifyCollectionChangedEventHandler |
SelectionChanged
Occurs when the SelectedItem or SelectedItems property value changes.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type | Description |
---|---|
SelectionChangedEventHandler |