Back to Devexpress

AccordionControl.SelectionUnit Property

wpf-devexpress-dot-xpf-dot-accordion-dot-accordioncontrol-3390f867.md

latest4.2 KB
Original Source

AccordionControl.SelectionUnit Property

Gets or sets whether an end-user can select subitems or both subitems and root items. This is a dependency property.

Namespace : DevExpress.Xpf.Accordion

Assembly : DevExpress.Xpf.Accordion.v25.2.dll

NuGet Package : DevExpress.Wpf.Accordion

Declaration

csharp
public SelectionUnit SelectionUnit { get; set; }
vb
Public Property SelectionUnit As SelectionUnit

Property Value

TypeDescription
SelectionUnit

A SelectionUnit enumeration value. The default is SelectionUnit.SubItemOrRootItem.

|

Available values:

NameDescription
SubItemOrRootItem

Both the root items and subitems can be selected.

| | SubItem |

Only subitems can be selected.

|

Remarks

You can specify accordion item types an end-user can select.

Set the SelectionUnit property to:

The following code sample demonstrates an AccordionControl that allows selecting subitems only:

xaml
<dxa:AccordionControl SelectionUnit="SubItem">
   <dxa:AccordionItem Header="Root Item" Glyph="{dx:DXImage Image=Image_32x32.png}"/>
   <dxa:AccordionItem Header="Root Item" Glyph="{dx:DXImage Image=Map_32x32.png}">
      <dxa:AccordionItem Header="SubItem" Glyph="{dx:DXImage Image=Map_16x16.png}"/>
      <dxa:AccordionItem Header="SubItem" Glyph="{dx:DXImage Image=Map_16x16.png}"/>
   </dxa:AccordionItem>
</dxa:AccordionControl>

The image below shows the result:

The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectionUnit property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-accordion-bind-to-data-hierarchicaldatatemplate/CS/HierarchicalDataTemplate/MainWindow.xaml#L20

xml
<Border Margin="5" Grid.Column="0" BorderBrush="Black" BorderThickness="1">
    <dxa:AccordionControl x:Name="accordion" SelectionUnit="SubItem"
                          ItemsSource="{Binding MyData.Categories }" SelectedItem="{Binding SelectedItem}">

wpf-accordion-bind-to-hierarchical-objects-of-different-types/CS/ChildrenSelector/MainWindow.xaml#L23

xml
<Border Margin="5" Grid.Column="0" BorderBrush="Black" BorderThickness="1">
    <dxa:AccordionControl Name="accordion" SelectionUnit="SubItem" ItemsSource="{Binding MyData.Categories }"
                          SelectedItem="{Binding SelectedItem}" ChildrenSelector="{StaticResource mySelector}">

See Also

AccordionControl Class

AccordionControl Members

DevExpress.Xpf.Accordion Namespace