Table of Contents
Disabled Items

An item can be easily disabled by setting IsEnabled to false on that item. The following XAML demonstrates this feature:

XAML
<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:eo="http://schemas.essentialobjects.com/wpf/"
        Title="MainWindow" Height="250" Width="350">
    <StackPanel>
        <eo:ComboBox Width="200" HorizontalAlignment="Left">
            <eo:ComboBoxItem IsEnabled="False">Item 1</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 2</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 3</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 4</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 5</eo:ComboBoxItem>
        </eo:ComboBox>
    </StackPanel>
</Window>

If an item's content is a complex object or use a template, setting IsEnabled to false on the root element of the template also has the same effect. For example:

XAML
<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:eo="http://schemas.essentialobjects.com/wpf/"
        Title="MainWindow" Height="250" Width="350">
    <StackPanel>
        <eo:ComboBox Width="200" HorizontalAlignment="Left">
            <eo:ComboBoxItem>
                <eo:ComboBoxItem.Template>
                    <ControlTemplate>
                        <Border IsEnabled="False" BorderBrush="DarkGray" BorderThickness="1">
                            <TextBlock>This item is disabled</TextBlock>
                        </Border>
                    </ControlTemplate>
                </eo:ComboBoxItem.Template>
            </eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 2</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 3</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 4</eo:ComboBoxItem>
            <eo:ComboBoxItem>Item 5</eo:ComboBoxItem>
        </eo:ComboBox>
    </StackPanel>
</Window>

Here the first ComboBoxItem will be automatically disabled because the root element of its content (the Border element) is disabled. This feature is very useful when the ComboBox is populated from ItemsSource because a ComboBoxItem object is not directly available in that case.