internal override void SetDialogProperties(IFileDialog dialog) { base.SetDialogProperties(dialog); if (_showReadOnly) { IFileDialogCustomize customise = (IFileDialogCustomize)dialog; customise.EnableOpenDropDown(_openDropDownId); customise.AddControlItem(_openDropDownId, _openItemId, ComDlgResources.LoadString(ComDlgResourceId.OpenButton)); customise.AddControlItem(_openDropDownId, _readOnlyItemId, ComDlgResources.LoadString(ComDlgResourceId.ReadOnly)); } }
internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Add the combo box control dialog.AddComboBox(this.Id); // Add the combo box items for (int index = 0; index < items.Count; index++) { dialog.AddControlItem(this.Id, index, items[index].Text); } // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException(LocalizedMessages.ComboBoxIndexOutsideBounds); } // Make this control prominent if needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync additional properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the RadioButtonList control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null"); // Add the radio button list control dialog.AddRadioButtonList(this.Id); // Add the radio button list items for (int index = 0; index < items.Count; index++) { dialog.AddControlItem(this.Id, index, items[index].Text); } // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException(LocalizedMessages.RadioButtonListIndexOutOfBounds); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
internal void Update(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Remove the control items. // Don't do RemoveAllControlItems. It's not implemented natively. for (int index = 0; index < oldCount; ++index) dialog.RemoveControlItem (Id, index); // Re-add the combo box items for (int index = 0; index < Items.Count; ++index) { string text = Items [index].Text; dialog.AddControlItem (Id, index, text); } // If we didn't, go select. if (Enabled) { SelectedIndex = 0; ApplyPropertyChange ("SelectedIndex"); } oldCount = Items.Count; // Sync additional properties SyncUnmanagedProperties (); }
internal void Update(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Remove the control items. // Don't do RemoveAllControlItems. It's not implemented natively. for (int index = 0; index < oldCount; ++index) { dialog.RemoveControlItem(Id, index); } // Re-add the combo box items for (int index = 0; index < Items.Count; ++index) { string text = Items [index].Text; dialog.AddControlItem(Id, index, text); } // If we didn't, go select. if (Enabled) { SelectedIndex = 0; ApplyPropertyChange("SelectedIndex"); } oldCount = Items.Count; // Sync additional properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the Menu control to the dialog object. /// </summary> /// <param name="dialog">the target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null"); // Add the menu control dialog.AddMenu(this.Id, this.Text); // Add the menu items foreach (CommonFileDialogMenuItem item in this.items) dialog.AddControlItem(this.Id, item.Id, item.Text); // Make prominent as needed if (IsProminent) dialog.MakeProminent(this.Id); // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the Menu control to the dialog object. /// </summary> /// <param name="dialog">the target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogMenu.Attach: dialog parameter can not be null"); // Add the menu control dialog.AddMenu(this.Id, this.Text); // Add the menu items foreach (CommonFileDialogMenuItem item in this.items) { dialog.AddControlItem(this.Id, item.Id, item.Text); } // Make prominent as needed if (IsProminent) { dialog.MakeProminent(this.Id); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the RadioButtonList control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogRadioButtonList.Attach: dialog parameter can not be null"); // Add the radio button list control dialog.AddRadioButtonList(this.Id); // Add the radio button list items for (int index = 0; index < items.Count; index++) dialog.AddControlItem(this.Id, index, items[index].Text); // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException("Index was outside the bounds of the CommonFileDialogRadioButtonList."); } // Sync unmanaged properties with managed properties SyncUnmanagedProperties(); }
/// <summary> /// Attach the ComboBox control to the dialog object /// </summary> /// <param name="dialog">The target dialog</param> internal override void Attach(IFileDialogCustomize dialog) { Debug.Assert(dialog != null, "CommonFileDialogComboBox.Attach: dialog parameter can not be null"); // Add the combo box control dialog.AddComboBox(this.Id); // Add the combo box items for (int index = 0; index < items.Count; index++) dialog.AddControlItem(this.Id, index, items[index].Text); // Set the currently selected item if (selectedIndex >= 0 && selectedIndex < items.Count) { dialog.SetSelectedControlItem(this.Id, this.selectedIndex); } else if (selectedIndex != -1) { throw new IndexOutOfRangeException("Index was outside the bounds of the CommonFileDialogComboBox."); } // Make this control prominent if needed if (IsProminent) dialog.MakeProminent(this.Id); // Sync additional properties SyncUnmanagedProperties(); }