/// <summary> /// Edits the specified object's value using the editor style indicated by GetEditStyle. /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param> /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((context != null) && (context.Instance != null) && (provider != null)) { // Must use the editor service for showing dialogs IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { // Cast the value to the correct type KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance; // Create the dialog used to edit the set of KryptonCheckButtons KryptonCheckButtonCollectionForm dialog = new KryptonCheckButtonCollectionForm(checkSet); if (editorService.ShowDialog(dialog) == DialogResult.OK) { // Notify container that value has been changed context.OnComponentChanged(); } } } // Return the original value return(value); }
/// <summary> /// Initialize a new instance of the KryptonCheckButtonCollectionForm class. /// </summary> public KryptonCheckButtonCollectionForm(KryptonCheckSet checkSet) { // Remember the owning control _checkSet = checkSet; InitializeComponent(); }
/// <summary> /// Returns a value indicating whether a particular value can be added to the standard values collection. /// </summary> /// <param name="context">An ITypeDescriptorContext that provides an additional context.</param> /// <param name="value">The value to check.</param> /// <returns></returns> protected override bool IsValueAllowed(ITypeDescriptorContext context, object value) { // Get access to the check set component that owns the property KryptonCheckSet checkSet = context.Instance as KryptonCheckSet; // Just in case the converter is used on a different type of component if (checkSet != null) { // We only allow check buttons inside the check set definition return(checkSet.CheckButtons.Contains(value as KryptonCheckButton)); } else { return(false); } }
/// <summary> /// Initialize a new instance of the KryptonCheckButtonCollection class. /// </summary> /// <param name="owner">Owning component</param> public KryptonCheckButtonCollection(KryptonCheckSet owner) { Debug.Assert(owner != null); _owner = owner; }
/// <summary> /// Initialize a new instance of the KryptonCheckSetActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonCheckSetActionList(KryptonCheckSetDesigner owner) : base(owner.Component) { // Remember the check set component instance _set = owner.Component as KryptonCheckSet; }