All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

CanSelectItemEventArgs.Item Property

Gets the processed item.

Namespace: DevExpress.Xpf.Accordion

Assembly: DevExpress.Xpf.Accordion.v20.1.dll

Declaration

public object Item { get; }
Public ReadOnly Property Item As Object

Property Value

Type Description
Object

A processed item.

Remarks

Use the Item property to get the processed item. To prevent this item from being selected, set the CanSelect property to false.

In Bound Mode

In bound mode, the Item property returns a bound data object.

The code sample below demonstrates how to prevent an item with the "Application Settings" caption from being selected.

<Window ...
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:dxa="http://schemas.devexpress.com/winfx/2008/xaml/accordion">
    <Grid>
        <dxa:AccordionControl
            ItemsSource="{Binding AppMenu.MenuItems}"
            DisplayMemberPath="Caption"
            ChildrenPath="SubItems"
            CanSelectItem="AccordionControl_CanSelectItem" />
    </Grid>
</Window>
private void AccordionControl_CanSelectItem(object sender, DevExpress.Xpf.Accordion.CanSelectItemEventArgs e) {
    MenuItem item = e.Item as MenuItem;
    if (item.Caption == "Application Settings") {
        e.CanSelect = false;
    }
}

In Unbound Mode

In unbound mode, the Item property returns an AccordionItem.

The code sample below demonstrates how to prevent an item with the "Application Settings" caption from being selected.

<Window ...
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:dxa="http://schemas.devexpress.com/winfx/2008/xaml/accordion">
    <Grid>
        <dxa:AccordionControl
            CanSelectItem="AccordionControl_CanSelectItem" >
            <dxa:AccordionItem Header="Start Page"/>
            <dxa:AccordionItem Header="Preferences">
                <dxa:AccordionItem Header="Account Info"/>
                <dxa:AccordionItem Header="Application Settings"/>
            </dxa:AccordionItem>
            <dxa:AccordionItem Header="About"/>
        </dxa:AccordionControl>
    </Grid>
</Window>
using DevExpress.Xpf.Accordion;
...

private void AccordionControl_CanSelectItem(object sender, CanSelectItemEventArgs e) {
    AccordionItem item = e.Item as AccordionItem;
    if (item.Header.ToString() == "Application Settings") {
        e.CanSelect = false;
    }
}
...
See Also