< Summary - PropertyGridHelpers Code Coverage

Information
Class: PropertyGridHelpers.UIEditors.ImageTextUIEditor<TEnum>
Assembly: PropertyGridHelpers
File(s): c:\agent\_work\9\s\Code\PropertyGridHelpers\UIEditors\ImageTextUIEditorT.cs
Tag: PropertyGridHelpers Build_2025.7.15.1_#485
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 86
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBlocks covered Blocks not covered
ImageTextUIEditor()30
ImageTextUIEditor(...)30

File(s)

c:\agent\_work\9\s\Code\PropertyGridHelpers\UIEditors\ImageTextUIEditorT.cs

#LineLine coverage
 1using PropertyGridHelpers.Attributes;
 2using PropertyGridHelpers.Converters;
 3using System;
 4using System.ComponentModel;
 5using System.Drawing.Design;
 6
 7namespace PropertyGridHelpers.UIEditors
 8{
 9    /// <summary>
 10    /// A generic <see cref="UITypeEditor" /> that displays an enumeration with both images and localized text in a drop
 11    /// </summary>
 12    /// <typeparam name="TEnum">The enumeration type to be edited. This must be a value type constrained to an <see cref
 13    /// <remarks>
 14    /// This class extends <see cref="ImageTextUIEditor" /> and uses the specified generic enum type <typeparamref name=
 15    /// to simplify application and enforce type safety. It supports localized display names
 16    /// via <see cref="LocalizedEnumTextAttribute" /> and image rendering via <see cref="EnumImageAttribute" />.
 17    /// <para>
 18    /// This editor is useful for properties where both textual meaning and visual context help the user choose the corr
 19    /// </para>
 20    /// </remarks>
 21    /// <example>
 22    /// To use this editor for an enum named <c>ButtonStyle</c>, define your enum with attributes:
 23    /// <code>
 24    /// public enum ButtonStyle
 25    /// {
 26    /// [EnumText("Flat"), EnumImage("FlatIcon")]
 27    /// Flat,
 28    /// [EnumText("Raised"), EnumImage("RaisedIcon")]
 29    /// Raised,
 30    /// [EnumText("3D"), EnumImage("ThreeDIcon")]
 31    /// ThreeD
 32    /// }
 33    /// </code>
 34    /// Then apply the editor to your property:
 35    /// <code>
 36    /// [Editor(typeof(ImageTextUIEditor&lt;ButtonStyle&gt;), typeof(UITypeEditor))]
 37    /// public ButtonStyle Style { get; set; }
 38    /// </code></example>
 39    /// <seealso cref="ImageTextUIEditor" />
 40    /// <seealso cref="EnumImageAttribute" />
 41    /// <seealso cref="LocalizedEnumTextAttribute" />
 42    /// <seealso cref="EnumTextConverter" />
 43#if NET35
 44    public partial class ImageTextUIEditor<TEnum> :
 45        ImageTextUIEditor
 46        where TEnum : struct
 47    {
 48        /// <summary>
 49        /// Initializes the <see cref="ImageTextUIEditor{TEnum}"/> class.
 50        /// </summary>
 51        /// <exception cref="ArgumentException">T must be an enumerated type</exception>
 52        static ImageTextUIEditor()
 53        {
 54            if (!typeof(TEnum).IsEnum)
 55                throw new ArgumentException("TEnum must be an enumerated type");
 56        }
 57
 58        /// <summary>
 59        /// Initializes a new instance of the <see cref="ImageTextUIEditor" /> class.
 60        /// </summary>
 61        public ImageTextUIEditor() : base(typeof(TEnum)) { }
 62
 63        /// <summary>
 64        /// Initializes a new instance of the <see cref="ImageTextUIEditor" /> class.
 65        /// </summary>
 66        /// <param name="ResourcePath">The path to the resources where the images are stored</param>
 67        public ImageTextUIEditor(string ResourcePath) : base(typeof(TEnum), ResourcePath) {}
 68    }
 69#else
 70    public partial class ImageTextUIEditor<TEnum>
 71        : ImageTextUIEditor
 72        where TEnum : struct, Enum
 73    {
 74        /// <summary>
 75        /// Initializes a new instance of the <see cref="ImageTextUIEditor" /> class.
 76        /// </summary>
 1677        public ImageTextUIEditor() : base(typeof(TEnum)) { }
 78
 79        /// <summary>
 80        /// Initializes a new instance of the <see cref="ImageTextUIEditor" /> class.
 81        /// </summary>
 82        /// <param name="ResourcePath">The path to the resources where the images are stored</param>
 1683        public ImageTextUIEditor(string ResourcePath) : base(typeof(TEnum), ResourcePath) { }
 84    }
 85#endif
 86}