| | 1 | | using PropertyGridHelpers.Controls; |
| | 2 | | using System.ComponentModel; |
| | 3 | | using System.Drawing.Design; |
| | 4 | | using System.Windows.Forms; |
| | 5 | |
|
| | 6 | | namespace PropertyGridHelpers.UIEditors |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// A reusable <see cref="UITypeEditor"/> for editing [Flags]-decorated enums |
| | 10 | | /// in a <see cref="PropertyGrid"/> using a drop-down checklist. |
| | 11 | | /// </summary> |
| | 12 | | /// <remarks> |
| | 13 | | /// This editor hosts a <see cref="FlagCheckedListBox"/> inside a drop-down |
| | 14 | | /// and is intended for use with enumerations marked with the |
| | 15 | | /// <see cref="System.FlagsAttribute"/>. The drop-down allows users to |
| | 16 | | /// select multiple values by checking corresponding options. |
| | 17 | | /// |
| | 18 | | /// The control handles bitwise logic internally, updating the composite |
| | 19 | | /// enum value based on the user's selection. |
| | 20 | | /// |
| | 21 | | /// Example usage: |
| | 22 | | /// <code> |
| | 23 | | /// [Editor(typeof(FlagEnumUIEditor), typeof(UITypeEditor))] |
| | 24 | | /// public MyFlagsEnum Options { get; set; } |
| | 25 | | /// </code> |
| | 26 | | /// |
| | 27 | | /// To customize the display text for enum values, consider using |
| | 28 | | /// <see cref="FlagEnumUIEditor{T}"/> with an <see cref="EnumConverter"/>. |
| | 29 | | /// </remarks> |
| | 30 | | /// <seealso cref="DropDownVisualizer{TControl}"/> |
| | 31 | | /// <seealso cref="FlagCheckedListBox"/> |
| | 32 | | /// <seealso cref="System.FlagsAttribute"/> |
| | 33 | | /// <seealso cref="UITypeEditor"/> |
| | 34 | | public partial class FlagEnumUIEditor : DropDownVisualizer<FlagCheckedListBox> |
| | 35 | | { |
| | 36 | | /// <summary> |
| | 37 | | /// Initializes a new instance of the <see cref="FlagEnumUIEditor"/> class, |
| | 38 | | /// configuring the drop-down checklist style. |
| | 39 | | /// </summary> |
| 32 | 40 | | public FlagEnumUIEditor() : base() => |
| 32 | 41 | | DropDownControl.BorderStyle = BorderStyle.None; |
| | 42 | | } |
| | 43 | | } |