Table of Contents
- Getting Started
- EO.Pdf
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
- .NET API Reference
- EO.Base
- EO.Base.UI
- EO.Extensions
- EO.Pdf
- EO.Pdf.Acm
- EO.Pdf.Contents
- EO.Pdf.Drawing
- EO.Pdf.Mvc
- EO.Web
- EO.WebBrowser
- EO.WebBrowser.DOM
- EO.WebEngine
- EO.WinForm
- EO.Wpf
- EO.Wpf
- Classes
- BareButton Class
- Bitmap Class
- BitmapButton Class
- BooleanDependencyPropertyRoutedEventArgs Class
- Button Class
- Calendar Class
- CalendarDayButton Class
- CalendarMonth Class
- CancelEventArgs Class
- CheckBox Class
- ChoiceMaskedEditSegment Class
- ComboBox Class
- ComboBoxItem Class
- DatePicker Class
- DateRangeCollection Class
- DateRangeCollectionConverter Class
- DockContainer Class
- DockItem Class
- DockItemClosingEventArgs Class
- DockItemCollection Class
- DockItemEventArgs Class
- DockItemNeededEventArgs Class
- DockView Class
- DockViewCollection Class
- DockViewCommands Class
- DockViewEventArgs Class
- DockViewNeededEventArgs Class
- DocumentItem Class
- DropDown Class
- DropDownButton Class
- DropDownService Class
- EditItemEventArgs Class
- Effect Class
- EffectManager Class
- Expander Class
- ItemDragEventArgs Class
- ItemDragOverEventArgs Class
- ItemDropEventArgs Class
- ItemsControlHelper Class
- LinkButton Class
- ListBox Class
- ListBoxItem Class
- MaskedEdit Class
- MaskedEditSegment Class
- MaskMaskedEditSegment Class
- Menu Class
- MenuBase Class
- MenuItem Class
- MonthPicker Class
- MultiplyConverter Class
- NamedResourceKey Class
- NegationConverter Class
- NewItemRequestedEventArgs Class
- NumericMaskedEditSegment Class
- OpacityConverter Class
- PatternMaskedEditSegment Class
- PdfViewer Class
- ProgressBar Class
- RadialPanel Class
- RadioButton Class
- RangeSlider Class
- RegexMaskedEditSegment Class
- RingDefinition Class
- RingDefinitionCollection Class
- Runtime Class
- SkinStyleInfo Class
- Slider Class
- SliderBase Class
- SpinEdit Class
- SplitButton Class
- SplitLineHeightConverter Class
- SplitView Class
- StaticMaskedEditSegment Class
- TabControl Class
- TabItem Class
- TabItemCloseEventArgs Class
- TabItemEventArgs Class
- TemplatePresenter Class
- ThemeManager Class
- ThemeNames Class
- ThemeStyleInfo Class
- TreeView Class
- TreeView Class
- TreeView Members
- TreeView Constructor
- Fields
- Properties
- Properties
- AllowDragCopy Property
- AllowDragItem Property
- AllowDropBetweenItems Property
- AllowDropItem Property
- AllowEditItem Property
- AutoCheckChildren Property
- AutoCheckParent Property
- DropHighlightBrush Property
- ItemBorderStyle Property
- SelectedItem Property
- SelectedValue Property
- SelectedValuePath Property
- ShowCheckBox Property
- TextBoxStyle Property
- Events
- TreeViewItem Class
- UIElementHelper Class
- UnitConverter Class
- WebControl Class
- WebView Class
- WebViewHost Class
- WeekDaysCollection Class
- WindowChrome Class
- WindowCommands Class
- YearPicker Class
- Structures
- Enumerations
- Delegates
- EO.Wpf.Gauge
- EO.Wpf.Gauge.Shapes
- EO.Wpf.Primitives
- EO.Wpf.Themes.Aero
- EO.Wpf.Themes.Classic
- EO.Wpf.Themes.Luna
- EO.Wpf.Themes.Metro
- EO.Wpf.Themes.Royale
- JavaScript API Reference
- .NET API Reference
SelectedItem Property |
Gets the selected item in a TreeView.
Syntax
Remarks
The selected item maybe a TreeViewItem object or maybe the data object that is used to create the TreeViewItem object. For example, in the following case where all TreeViewItems are directly declared in XAML, the SelectedItem is a TreeViewItem object:
XAML
<eo:TreeView> <eo:TreeViewItem Header="Item 1"></eo:TreeViewItem> <eo:TreeViewItem Header="Item 2"></eo:TreeViewItem> <eo:TreeViewItem Header="Item 3"></eo:TreeViewItem> </eo:TreeView>
In this case, you can use the following code to get the selected item text:
//Get the selected TreeViewItem TreeViewItem item = (TreeViewItem)TreeView1.SelectedItem; //Get the item text string itemText = (string)item.Header;
If the TreeView is populated from an ItemsSource, then SelectedItem will be the source data item object. For example, the following code initializes the TreeView with two TreeViewItems:
TreeView1.ItemsSource = new string[]{"Item 1", "Item 2"};
In this case, SelectedItem will be the string "Item 1" or "Item 2".
See Also