// OK clicked private void apply_Click(object sender, EventArgs e) { //mxd. Store current filter name string currentfiltername = string.Empty; if (!(General.Map.ThingsFilter is NullThingsFilter)) { currentfiltername = General.Map.ThingsFilter.Name; } // Clear all filters and add the new ones General.Map.ConfigSettings.ThingsFilters.Clear(); ThingsFilter currentfilter = new NullThingsFilter(); //mxd foreach (ListViewItem item in listfilters.Items) { ThingsFilter f = item.Tag as ThingsFilter; //mxd if (!string.IsNullOrEmpty(currentfiltername) && f.Name == currentfiltername) //mxd { currentfilter = f; } General.Map.ConfigSettings.ThingsFilters.Add(f); } // Update stuff General.Map.ChangeThingFilter(currentfilter); General.MainWindow.UpdateThingsFilters(); General.Map.ConfigSettings.Changed = true; // Close this.DialogResult = DialogResult.OK; this.Close(); }
// Field clicked private void filterfield_Check(object sender, EventArgs e) { // Get the checkbox CheckBox box = (sender as CheckBox); // Not setting up? if (!settingup) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // New state is required? /*if(box.CheckState == CheckState.Checked) * { * f.ForbiddenFields.Remove(box.Tag.ToString()); * if(!f.RequiredFields.Contains(box.Tag.ToString())) f.RequiredFields.Add(box.Tag.ToString()); * } * // New state is forbidden? * else if(box.CheckState == CheckState.Unchecked) * { * f.RequiredFields.Remove(box.Tag.ToString()); * if(!f.ForbiddenFields.Contains(box.Tag.ToString())) f.ForbiddenFields.Add(box.Tag.ToString()); * } * else * { * f.ForbiddenFields.Remove(box.Tag.ToString()); * f.RequiredFields.Remove(box.Tag.ToString()); * }*/ } } }
// This changes thing filter public void ChangeThingFilter(ThingsFilter newfilter) { // We have a special filter for null if (newfilter == null) { newfilter = new NullThingsFilter(); } // Deactivate old filter if (thingsfilter != null) { thingsfilter.Deactivate(); } // Change thingsfilter = newfilter; // Activate filter thingsfilter.Activate(); // Update interface General.MainWindow.ReflectThingsFilter(); // Redraw General.MainWindow.RedrawDisplay(); }
private void fieldslist_Validated(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; fieldslist.Apply(f.ThingCustomFields); } }
//mxd private void ValidateFilter(ListViewItem item, ThingsFilter f) { int imageindex = (f.IsValid() ? -1 : 0); if (item.ImageIndex != imageindex) { item.ImageIndex = imageindex; listfilters.Invalidate(); } }
//mxd private void invert_CheckedChanged(object sender, EventArgs e) { // Anything selected? if (!settingup && listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; f.Invert = invert.Checked; } }
/*private void filteraction_ValueChanges(object sender, EventArgs e) * { * int showaction = 0; * PropertyInfo[] arginfo; * * // Anything selected? * if(listfilters.SelectedItems.Count > 0) * { * // Get selected filter * ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; * if(filteraction.Empty) * f.ThingAction = -1; * else * f.ThingAction = filteraction.GetValue(); * } * * // Only when line type is known, otherwise use the thing arguments * if(General.Map.Config.LinedefActions.ContainsKey(filteraction.Value)) showaction = filteraction.Value; * arginfo = General.Map.Config.LinedefActions[showaction].Args; * * // Change the argument descriptions * arg0label.Text = arginfo[0].Title + ":"; * arg1label.Text = arginfo[1].Title + ":"; * arg2label.Text = arginfo[2].Title + ":"; * arg3label.Text = arginfo[3].Title + ":"; * arg4label.Text = arginfo[4].Title + ":"; * arg0label.Enabled = arginfo[0].Used; * arg1label.Enabled = arginfo[1].Used; * arg2label.Enabled = arginfo[2].Used; * arg3label.Enabled = arginfo[3].Used; * arg4label.Enabled = arginfo[4].Used; * if(arg0label.Enabled) arg0.ForeColor = SystemColors.WindowText; else arg0.ForeColor = SystemColors.GrayText; * if(arg1label.Enabled) arg1.ForeColor = SystemColors.WindowText; else arg1.ForeColor = SystemColors.GrayText; * if(arg2label.Enabled) arg2.ForeColor = SystemColors.WindowText; else arg2.ForeColor = SystemColors.GrayText; * if(arg3label.Enabled) arg3.ForeColor = SystemColors.WindowText; else arg3.ForeColor = SystemColors.GrayText; * if(arg4label.Enabled) arg4.ForeColor = SystemColors.WindowText; else arg4.ForeColor = SystemColors.GrayText; * arg0.Setup(arginfo[0]); * arg1.Setup(arginfo[1]); * arg2.Setup(arginfo[2]); * arg3.Setup(arginfo[3]); * arg4.Setup(arginfo[4]); * }*/ /*private void browseaction_Click(object sender, EventArgs e) * { * filteraction.Value = ActionBrowserForm.BrowseAction(this, filteraction.Value); * }*/ private void filtertag_WhenTextChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; f.HiTag = filtertag.GetResult(-1); } }
//mxd private void filtermode_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (!settingup && listfilters.SelectedItems.Count > 0 && filtermode.SelectedIndex != -1) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; f.DisplayMode = (ThingsFilterDisplayMode)filtermode.SelectedIndex; } }
private void filterzheight_WhenTextChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; f.ZHeight = filterzheight.GetResult(int.MinValue); } }
// Thing Filters private void LoadSpriteFilters() { // Get sets IDictionary dic = cfg.ReadSetting("spritefilters", new Hashtable()); foreach (DictionaryEntry de in dic) { ThingsFilter f = new ThingsFilter(cfg, "spritefilters." + de.Key); thingfilters.Add(f); } }
private void filterangle_WhenTextChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; f.ThingAngle = filterangle.GetResult(-1); ValidateFilter(listfilters.SelectedItems[0], f); //mxd } }
// Thing Filters private void LoadThingFilters() { IDictionary dic; // Get sets dic = cfg.ReadSetting("thingsfilters", new Hashtable()); foreach (DictionaryEntry de in dic) { ThingsFilter f = new ThingsFilter(cfg, "thingsfilters." + de.Key.ToString()); thingfilters.Add(f); } }
private void filteraction_ValueChanges(object sender, EventArgs e) { int showaction = 0; // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; if (filteraction.Empty) { f.ThingAction = -1; } else { f.ThingAction = filteraction.GetValue(); } ValidateFilter(listfilters.SelectedItems[0], f); //mxd } // Only when line type is known, otherwise use the thing arguments if (General.Map.Config.LinedefActions.ContainsKey(filteraction.Value)) { showaction = filteraction.Value; } ArgumentInfo[] arginfo = General.Map.Config.LinedefActions[showaction].Args; // Change the argument descriptions arg0label.Text = arginfo[0].Title + ":"; arg1label.Text = arginfo[1].Title + ":"; arg2label.Text = arginfo[2].Title + ":"; arg3label.Text = arginfo[3].Title + ":"; arg4label.Text = arginfo[4].Title + ":"; arg0label.Enabled = arginfo[0].Used; arg1label.Enabled = arginfo[1].Used; arg2label.Enabled = arginfo[2].Used; arg3label.Enabled = arginfo[3].Used; arg4label.Enabled = arginfo[4].Used; arg0.ForeColor = (arg0label.Enabled ? SystemColors.WindowText : SystemColors.GrayText); arg1.ForeColor = (arg1label.Enabled ? SystemColors.WindowText : SystemColors.GrayText); arg2.ForeColor = (arg2label.Enabled ? SystemColors.WindowText : SystemColors.GrayText); arg3.ForeColor = (arg3label.Enabled ? SystemColors.WindowText : SystemColors.GrayText); arg4.ForeColor = (arg4label.Enabled ? SystemColors.WindowText : SystemColors.GrayText); arg0.Setup(arginfo[0]); arg1.Setup(arginfo[1]); arg2.Setup(arginfo[2]); arg3.Setup(arginfo[3]); arg4.Setup(arginfo[4]); }
// Constructor internal MapManager() { // Create temporary path temppath = General.MakeTempDirname(); Directory.CreateDirectory(temppath); General.WriteLogLine("Temporary directory: " + temppath); // Basic objects grid = new GridSetup(); undoredo = new UndoManager(); copypaste = new CopyPasteManager(); launcher = new Launcher(); thingsfilter = new NullThingsFilter(); }
private void arg_Validated(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; int index; int.TryParse((sender as Control).Tag.ToString(), out index); ArgumentBox filterarg = (sender as ArgumentBox); f.ThingArgs[index] = filterarg.GetResult(-1); } }
private void filtertype_ValueChanges(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; /*if(filtertype.Empty) * f.TileIndex = -1; * else * f.TileIndex = filtertype.GetValue();*/ } }
// New Filter clicked private void addfilter_Click(object sender, EventArgs e) { ThingsFilter newf = new ThingsFilter(); // Make item in list and select it ListViewItem item = new ListViewItem(newf.Name); item.Tag = newf; listfilters.Items.Add(item); item.Selected = true; // Focus on the name field filtername.Focus(); filtername.SelectAll(); }
private void filtertype_ValueChanges(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; if (filtertype.Empty) { f.ThingType = -1; } else { f.ThingType = filtertype.GetValue(); } } }
// Rename filter private void filtername_Validating(object sender, CancelEventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Name changed? if (f.Name != filtername.Text) { // Update name f.Name = filtername.Text; listfilters.SelectedItems[0].Text = f.Name; listfilters.Sort(); } } }
// Field clicked private void filterfield_Check(object sender, EventArgs e) { // Get the checkbox CheckBox box = (sender as CheckBox); // Not setting up? if (!settingup) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; switch (box.CheckState) { // New state is required? case CheckState.Checked: f.ForbiddenFields.Remove(box.Tag.ToString()); if (!f.RequiredFields.Contains(box.Tag.ToString())) { f.RequiredFields.Add(box.Tag.ToString()); } break; // New state is forbidden? case CheckState.Unchecked: f.RequiredFields.Remove(box.Tag.ToString()); if (!f.ForbiddenFields.Contains(box.Tag.ToString())) { f.ForbiddenFields.Add(box.Tag.ToString()); } break; default: f.ForbiddenFields.Remove(box.Tag.ToString()); f.RequiredFields.Remove(box.Tag.ToString()); break; } ValidateFilter(listfilters.SelectedItems[0], f); //mxd } } }
// Constructor public ThingsFiltersForm() { settingup = true; // Initialize InitializeComponent(); // Fill the categories combobox filtercategory.Items.Add("(any category)"); filtercategory.Items.AddRange(General.Map.Data.ThingCategories.ToArray()); // Fill checkboxes list foreach (KeyValuePair <string, string> flag in General.Map.Config.ThingFlags) { CheckBox box = filterfields.Add(flag.Value, flag.Key); box.ThreeState = true; box.CheckStateChanged += new EventHandler(filterfield_Check); } // Fill list of filters foreach (ThingsFilter f in General.Map.ConfigSettings.ThingsFilters) { // Make a copy (we don't want to modify the filters until OK is clicked) ThingsFilter nf = new ThingsFilter(f); // Make item in list ListViewItem item = new ListViewItem(nf.Name); item.Tag = nf; listfilters.Items.Add(item); // Select item if this is the current filter if (General.Map.ThingsFilter == f) { item.Selected = true; } } // Sort the list listfilters.Sort(); // Done settingup = false; }
// Category changed private void filtercategory_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Category selected if ((filtercategory.SelectedIndex > -1) && (filtercategory.SelectedItem is SpriteCategory)) { // Set new category name f.CategoryName = (filtercategory.SelectedItem as SpriteCategory).Name; } else { // Unset category name f.CategoryName = ""; } } }
// Rename filter private void filtername_Validating(object sender, CancelEventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Name changed? if (string.IsNullOrEmpty(filtername.Text)) { filtername.Text = ThingsFilter.DEFAULT_NAME; //mxd } if (f.Name != filtername.Text) { // Update name f.Name = filtername.Text; listfilters.SelectedItems[0].Text = f.Name; listfilters.Sort(); } } }
// Category changed private void filtercategory_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (!settingup && listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Category selected if ((filtercategory.SelectedIndex > -1) && (filtercategory.SelectedItem is ThingCategoryData)) { // Set new category name f.CategoryName = ((ThingCategoryData)filtercategory.SelectedItem).Category.Name; //mxd } else { // Unset category name f.CategoryName = ""; } ValidateFilter(listfilters.SelectedItems[0], f); //mxd } }
// Constructor public ThingsFiltersForm() { settingup = true; // Initialize InitializeComponent(); // Fill types list /*List<SpriteInfo> thingtypes = new List<SpriteInfo>(General.Map.Data.ThingTypes); * INumberedTitle[] typeitems = new INumberedTitle[thingtypes.Count]; * for(int i = 0; i < thingtypes.Count; i++) typeitems[i] = thingtypes[i]; * filtertype.AddInfo(typeitems); * * // Fill the categories combobox * filtercategory.Items.Add("(any category)"); * filtercategory.Items.AddRange(General.Map.Data.ThingCategories.ToArray()); * * // Fill actions list * filteraction.GeneralizedCategories = General.Map.Config.GenActionCategories; * filteraction.AddInfo(General.Map.Config.SortedLinedefActions.ToArray()); * * // Initialize custom fields editor * fieldslist.ListNoFixedFields(); * fieldslist.Setup("thing");*/ // Fill checkboxes list foreach (KeyValuePair <string, string> flag in General.Map.Config.SpriteFlags) { CheckBox box = filterfields.Add(flag.Value, flag.Key); box.ThreeState = true; box.CheckStateChanged += filterfield_Check; } // Fill list of filters foreach (ThingsFilter f in General.Map.ConfigSettings.ThingsFilters) { // Make a copy (we don't want to modify the filters until OK is clicked) ThingsFilter nf = new ThingsFilter(f); // Make item in list ListViewItem item = new ListViewItem(nf.Name); item.Tag = nf; listfilters.Items.Add(item); // Select item if this is the current filter if (General.Map.ThingsFilter == f) { item.Selected = true; } } // Sort the list listfilters.Sort(); // Map format specific fields /*filterzheight.Visible = General.Map.FormatInterface.HasThingHeight; * labelzheight.Visible = General.Map.FormatInterface.HasThingHeight; * argumentspanel.Visible = General.Map.FormatInterface.HasActionArgs; * labeltag.Visible = General.Map.FormatInterface.HasThingTag; * filtertag.Visible = General.Map.FormatInterface.HasThingTag; * if(!General.Map.FormatInterface.HasCustomFields) * tabs.TabPages.Remove(tabcustom); * if(!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag) * tabs.TabPages.Remove(tabaction);*/ // Done settingup = false; }
// Item selected private void listfilters_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Enable settings settingup = true; deletefilter.Enabled = true; filtergroup.Enabled = true; // Show name filtername.Text = f.Name; // Properties foreach (object c in filtercategory.Items) { SpriteCategory tc = (c as SpriteCategory); if ((tc != null) && (tc.Name == f.CategoryName)) { filtercategory.SelectedItem = tc; } } if (filtercategory.SelectedIndex == -1) { filtercategory.SelectedIndex = 0; } /*if(f.TileIndex > -1) * filtertype.Value = f.TileIndex; * else * filtertype.Empty = true;*/ if (f.Angle > -1) { filterangle.Text = f.Angle.ToString(); } else { filterangle.Text = ""; } if (f.ZHeight > int.MinValue) { filterzheight.Text = f.ZHeight.ToString(); } else { filterzheight.Text = ""; } // Action /*if(f.ThingAction > -1) * filteraction.Value = f.ThingAction; * else * filteraction.Empty = true; * * if(f.ThingArgs[0] > -1) arg0.SetValue(f.ThingArgs[0]); else arg0.ClearValue(); * if(f.ThingArgs[1] > -1) arg1.SetValue(f.ThingArgs[1]); else arg1.ClearValue(); * if(f.ThingArgs[2] > -1) arg2.SetValue(f.ThingArgs[2]); else arg2.ClearValue(); * if(f.ThingArgs[3] > -1) arg3.SetValue(f.ThingArgs[3]); else arg3.ClearValue(); * if(f.ThingArgs[4] > -1) arg4.SetValue(f.ThingArgs[4]); else arg4.ClearValue();*/ if (f.HiTag > -1) { filtertag.Text = f.HiTag.ToString(); } else { filtertag.Text = ""; } // Flags foreach (CheckBox b in filterfields.Checkboxes) { // Field name forbidden? /*if(f.ForbiddenFields.Contains(b.Tag.ToString())) * { * b.CheckState = CheckState.Unchecked; * } * // Field name required? * else if(f.RequiredFields.Contains(b.Tag.ToString())) * { * b.CheckState = CheckState.Checked; * } * else * { * b.CheckState = CheckState.Indeterminate; * }*/ } // Custom fields /*fieldslist.ClearFields(); * fieldslist.Setup("thing"); * fieldslist.SetValues(f.ThingCustomFields, true);*/ // Done settingup = false; } else { // Disable filter settings deletefilter.Enabled = false; filtergroup.Enabled = false; filtername.Text = ""; filtercategory.SelectedIndex = -1; foreach (CheckBox c in filterfields.Checkboxes) { c.CheckState = CheckState.Indeterminate; } } }
// Item selected private void listfilters_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Enable settings settingup = true; deletefilter.Enabled = true; filtergroup.Enabled = true; // Show name filtername.Text = f.Name; //mxd. Set display mode filtermode.SelectedIndex = (int)f.DisplayMode; //mxd. Invert? invert.Checked = f.Invert; // Properties foreach (object c in filtercategory.Items) { ThingCategoryData tc = (c as ThingCategoryData); //mxd if ((tc != null) && (tc.Category.Name == f.CategoryName)) { filtercategory.SelectedItem = tc; } } if (filtercategory.SelectedIndex == -1) { filtercategory.SelectedIndex = 0; } if (f.ThingType > -1) { filtertype.Value = f.ThingType; } else { filtertype.Empty = true; } if (f.ThingAngle > -1) { filterangle.Text = f.ThingAngle.ToString(); } else { filterangle.Text = ""; } if (f.ThingZHeight > int.MinValue) { filterzheight.Text = f.ThingZHeight.ToString(); } else { filterzheight.Text = ""; } // Action if (f.ThingAction > -1) { filteraction.Value = f.ThingAction; } else { filteraction.Empty = true; } if (f.ThingArgs[0] > -1) { arg0.SetValue(f.ThingArgs[0]); } else { arg0.ClearValue(); } if (f.ThingArgs[1] > -1) { arg1.SetValue(f.ThingArgs[1]); } else { arg1.ClearValue(); } if (f.ThingArgs[2] > -1) { arg2.SetValue(f.ThingArgs[2]); } else { arg2.ClearValue(); } if (f.ThingArgs[3] > -1) { arg3.SetValue(f.ThingArgs[3]); } else { arg3.ClearValue(); } if (f.ThingArgs[4] > -1) { arg4.SetValue(f.ThingArgs[4]); } else { arg4.ClearValue(); } if (f.ThingTag > -1) { filtertag.Text = f.ThingTag.ToString(); } else { filtertag.Text = ""; } // Flags foreach (CheckBox b in filterfields.Checkboxes) { // Field name forbidden? if (f.ForbiddenFields.Contains(b.Tag.ToString())) { b.CheckState = CheckState.Unchecked; } // Field name required? else if (f.RequiredFields.Contains(b.Tag.ToString())) { b.CheckState = CheckState.Checked; } else { b.CheckState = CheckState.Indeterminate; } } // Custom fields if (General.Map.FormatInterface.HasCustomFields) //mxd { fieldslist.ClearFields(); fieldslist.Setup("thing"); fieldslist.SetValues(f.ThingCustomFields, true); } // Done settingup = false; } else { // Disable filter settings deletefilter.Enabled = false; filtergroup.Enabled = false; filtername.Text = ""; filtercategory.SelectedIndex = -1; foreach (CheckBox c in filterfields.Checkboxes) { c.CheckState = CheckState.Indeterminate; } } }
// Item selected private void listfilters_SelectedIndexChanged(object sender, EventArgs e) { // Anything selected? if (listfilters.SelectedItems.Count > 0) { // Get selected filter ThingsFilter f = listfilters.SelectedItems[0].Tag as ThingsFilter; // Enable settings settingup = true; deletefilter.Enabled = true; filtergroup.Enabled = true; // Show name filtername.Text = f.Name; // Show category foreach (object c in filtercategory.Items) { ThingCategory tc = (c as ThingCategory); if ((tc != null) && (tc.Name == f.CategoryName)) { filtercategory.SelectedItem = tc; } } if (filtercategory.SelectedIndex == -1) { filtercategory.SelectedIndex = 0; } // Show fields foreach (CheckBox b in filterfields.Checkboxes) { // Field name forbidden? if (f.ForbiddenFields.Contains(b.Tag.ToString())) { b.CheckState = CheckState.Unchecked; } // Field name required? else if (f.RequiredFields.Contains(b.Tag.ToString())) { b.CheckState = CheckState.Checked; } else { b.CheckState = CheckState.Indeterminate; } } // Done settingup = false; } else { // Disable filter settings deletefilter.Enabled = false; filtergroup.Enabled = false; filtername.Text = ""; filtercategory.SelectedIndex = -1; foreach (CheckBox c in filterfields.Checkboxes) { c.CheckState = CheckState.Indeterminate; } } }