private void RemoveSelection(ItemSelectionChangedEventArgs e, MyCheckComboBox box) { if (box.SelectedItems.Count > 0 && box.SelectedItems.Count == box.Items.Count) { box.SelectedItems.RemoveAt(0); } else { for (int i = box.SelectedItems.Count - 1; i >= 0; i--) { while (i > box.SelectedItems.Count - 1 && i > 0) { i--; } box.SelectedItems.RemoveAt(i); } } }
private void ItemSelectionChanged(ItemSelectionChangedEventArgs e, MyCheckComboBox box) { var item = e.Item; if (item.Equals("Select All")) { select_all = true; // Select All if (e.IsSelected) { foreach (var data in box.Items) { var selectorItem = box.ItemContainerGenerator.ContainerFromItem(data) as SelectorItem; if ((selectorItem != null) && !selectorItem.IsSelected) { box.SelectedItems.Add(data); } } } else { for (int i = box.SelectedItems.Count - 1; i >= 0; i--) { box.SelectedItems.RemoveAt(i); } } select_all = false; } else { // UnSelect an item => make sure the “Select All” option is not selected. if (!e.IsSelected) { box.SelectedItems.Remove("Select All"); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Element_type = ((System.Windows.Controls.TextBlock)(target)); return; case 2: this.Group = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 3: this.Generate = ((System.Windows.Controls.Button)(target)); #line 20 "..\..\GenerationWindow.xaml" this.Generate.Click += new System.Windows.RoutedEventHandler(this.Generate_Click); #line default #line hidden return; case 4: this.View = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 5: this.ElementType = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 6: this.ViewSearch = ((System.Windows.Controls.TextBox)(target)); #line 30 "..\..\GenerationWindow.xaml" this.ViewSearch.KeyUp += new System.Windows.Input.KeyEventHandler(this.ViewSearch_KeyUp_1); #line default #line hidden return; case 7: this.GroupSearch = ((System.Windows.Controls.TextBox)(target)); #line 31 "..\..\GenerationWindow.xaml" this.GroupSearch.KeyUp += new System.Windows.Input.KeyEventHandler(this.GroupSearch_KeyUp_1); #line default #line hidden return; case 8: this.NameSpace = ((System.Windows.Controls.TextBox)(target)); return; case 9: this.Element = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 10: this.ElementSearch = ((System.Windows.Controls.TextBox)(target)); #line 38 "..\..\GenerationWindow.xaml" this.ElementSearch.KeyUp += new System.Windows.Input.KeyEventHandler(this.ElementSearch_KeyUp); #line default #line hidden return; case 11: this.Project = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 12: this.ProjectSearch = ((System.Windows.Controls.TextBox)(target)); #line 43 "..\..\GenerationWindow.xaml" this.ProjectSearch.KeyUp += new System.Windows.Input.KeyEventHandler(this.ProjectSearch_KeyUp); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Element_type = ((System.Windows.Controls.TextBlock)(target)); return; case 2: this.XMLPath = ((System.Windows.Controls.TextBox)(target)); #line 14 "..\..\SolutionGenerationWindow.xaml" this.XMLPath.LostFocus += new System.Windows.RoutedEventHandler(this.XMLPath_LostFocus); #line default #line hidden return; case 3: this.Element_type_Copy = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.SolutionPath = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.Solution_TextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.SolutionName = ((ArchimateGeneratorExtension.MyCheckComboBox)(target)); return; case 7: this.Generate = ((System.Windows.Controls.Button)(target)); #line 21 "..\..\SolutionGenerationWindow.xaml" this.Generate.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default #line hidden return; case 8: #line 22 "..\..\SolutionGenerationWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); #line default #line hidden return; case 9: #line 23 "..\..\SolutionGenerationWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2); #line default #line hidden return; } this._contentLoaded = true; }