/// <summary> /// Initializes a new instance of the <see cref="ResourcesCategoryAttribute"/> class. /// </summary> /// <param name="resourceType">Type of the resource file.</param> /// <param name="resourceName">Name of the string resource property to be used as category.</param> /// <param name="position">The position of the category.</param> /// <param name="totalCategories">The total amount of categories in the control.</param> /// <exception cref="InvalidOperationException">Thrown when the resource cannot be found /// or does not have the given resource name.</exception> /// <remarks>Implemented as proposed at http://stackoverflow.com/a/21441892/. </remarks> public ResourcesCategoryAttribute(Type resourceType, string resourceName, ushort position = 0, ushort totalCategories = 0) : base(ResourceHelper.GetResourceLookup(resourceType, resourceName) .PadLeft(ResourceHelper.GetResourceLookup(resourceType, resourceName).Length + (totalCategories - position), nonPrintableChar)) { }
/// <summary> /// Initializes a new instance of the <see cref="ResourcesDescriptionAttribute"/> class. /// </summary> /// <param name="resourceType">Type of the resource file.</param> /// <param name="resourceName">Name of the string resource property to be used as description.</param> /// <exception cref="InvalidOperationException">Thrown when the resource cannot be found /// or does not have the given resource name.</exception> public ResourcesDescriptionAttribute(Type resourceType, string resourceName) : base(ResourceHelper.GetResourceLookup(resourceType, resourceName)) { }
/// <summary> /// Initializes a new instance of the <see cref="ResourcesDisplayNameAttribute"/> class. /// </summary> /// <param name="resourceType">Type of the resource file.</param> /// <param name="resourceName">Name of the string resource property to be used as display name.</param> /// <exception cref="InvalidOperationException">Thrown when the resource cannot be found /// or does not have the given resource name.</exception> public ResourcesDisplayNameAttribute(Type resourceType, string resourceName) : base(ResourceHelper.GetResourceLookup(resourceType, resourceName)) { }