Posted by: Zeeshan Amjad | October 20, 2009

Embedded Combo Box Inside Tree Control


Due to the flexible architecture of WPF we can easily embed one control inside another. Here is one example to use combo box inside the tree control.

  1: <Window x:Class="objDataProvider.Window1"
  2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4:     xmlns:System="clr-namespace:System;assembly=mscorlib"
  5:     xmlns:odp="clr-namespace:objDataProvider"
  6:     Title="Combo Inside Tree" Height="300" Width="400">
  7: 
  8:     <TreeView>
  9:         <TreeViewItem Header="Tree Item 1">
 10:             <ComboBox>
 11:                 <ComboBoxItem>Combo Item 1</ComboBoxItem>
 12:                 <ComboBoxItem>Combo Item 2</ComboBoxItem>
 13:                 <ComboBoxItem>Combo Item 3</ComboBoxItem>
 14:             </ComboBox>
 15:         </TreeViewItem>
 16:         <TreeViewItem Header="Tree Item 2">
 17:             <TreeViewItem Header="Tree Item 2.1"/>
 18:             <TreeViewItem Header="Tree Item 2.2"/>
 19:             <TreeViewItem Header="Tree Item 2.3"/>
 20:             <TreeViewItem Header="Tree Item 2.4"/>
 21:         </TreeViewItem>
 22:     </TreeView>
 23: </Window>
 24: 

Here is the output of this program

ComboInTree

Advertisements

Responses

  1. […] already saw couple of examples of combo box. Here we saw combo box inside tree view, here inside list view,  here inside tab control and here […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: