Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Wider string property

$
0
0

I'm trying to get the input fields on some of my string properties wider.

I have made a property, a custom UIHint and an EditorDescriptor.

I can make all string properties wider with the EditorDescriptor but when restricting to a specific UIHint nothing happens.

When I specify UiHint and debug I can see that the code in the EditorDescriptor is running but it doesn't change the property's appearance.

Am I missing something? Or isn't this possible, and why would it be possible to specify UiHint then?

Example property:

[Display(not relevant)]
[UIHint(SiteUiHints.WiderInput)]
public virtual string Title { get; set; }

UiHint:

public static class SiteUiHints
{
    public const string WiderInput = "WiderInput";
}

EditorDescriptor:

[EditorDescriptorRegistration(EditorDescriptorBehavior = EditorDescriptorBehavior.PlaceLast, TargetType = typeof(string), UIHint = SiteUiHints.WiderInput)]
public class WiderInputEditorDescriptor : EditorDescriptor
{
    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
    {
        base.ModifyMetadata(metadata, attributes);
        metadata.EditorConfiguration.Add("style", "width: 582px;");
    }
}

Viewing all articles
Browse latest Browse all 9076

Trending Articles