Table of Contents
- Getting Started
- EO.Pdf
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Overview
- Installation & Deployement
- Skin & Theme
- Common Taskes and Services
- EO.Wpf Buttons
- EO.Wpf Calendar & DatePicker
- EO.Wpf ComboBox
- EO.Wpf DockView
- EO.Wpf Gauge
- EO.Wpf ListBox
- EO.Wpf Menu
- EO.Wpf MaskedEdit
- EO.Wpf ProgressBar
- EO.Wpf Slider
- EO.Wpf SpinEdit
- EO.Wpf SplitView
- EO.Wpf TabControl
- EO.Wpf TreeView
- EO.Wpf Utility Controls
- EO.Wpf WindowChrome
- Sample Data Objects
- Common Topics
- Reference
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.