private void Initialize() { TreeViewItem columnsItem = new TreeViewItem(); MenuItem exclude = new MenuItem() { Header = "Exclude From Project" }; exclude.IsCheckable = true; exclude.IsChecked = _tableMapping.Exclude; exclude.Click += new RoutedEventHandler(ExcludeFromProjectMenuItem_Click); this.ContextMenu = new ContextMenu(); this.ContextMenu.Items.Add(exclude); columnsItem.Header = "Columns"; this.Items.Add(columnsItem); for (int i = 0; i < _tableMapping.ColumnMappings.Count; i++) { ColumnTreeNode item = new ColumnTreeNode(_tableMapping.ColumnMappings[i]); columnsItem.Items.Add(item); } if (_tableMapping.UniqueIndexMappings.Count > 0) { TreeViewItem uniqueIndicesItem = new TreeViewItem(); uniqueIndicesItem.Header = "Unique Indices"; this.Items.Add(uniqueIndicesItem); for (int i = 0; i < _tableMapping.UniqueIndexMappings.Count; i++) { UniqueIndexTreeNode item = new UniqueIndexTreeNode(_tableMapping.UniqueIndexMappings[i]); uniqueIndicesItem.Items.Add(item); } } UpdateNode(); }