Created
February 18, 2013 16:34
-
-
Save folkertsj/4978637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allows us to define our own Dropdown options from code.(UIHint) | |
[UIHint("BackgroundPlacementMultiple"), Display(Name = "Background Position", Order = 20, Description = "The background placement for the backgrou image of this block")] | |
public virtual string BackgroundPlacement { get; set; } | |
public class BackgroundSelectionFactory : ISelectionFactory | |
{ | |
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata) | |
{ | |
var backgroundOptions = new List<SelectItem>(); | |
backgroundOptions.Add(new SelectItem() { Text = "Top Left", Value = "tl" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Top Center", Value = "tc" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Top Right", Value = "tr" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Center Left", Value = "cl" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Center Center", Value = "cc" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Center Right", Value = "cr" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Bottom Left", Value = "bl" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Bottom Center", Value = "bc" }); | |
backgroundOptions.Add(new SelectItem() { Text = "Bottom Right", Value = "br" }); | |
return backgroundOptions; | |
} | |
} | |
[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "BackgroundPlacementMultiple")] | |
public class BackgroundMultipleEditorDescriptor : EditorDescriptor | |
{ | |
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes) | |
{ | |
SelectionFactoryType = typeof(BackgroundSelectionFactory); | |
ClientEditingClass = "epi.cms.contentediting.editors.SelectionEditor"; | |
base.ModifyMetadata(metadata, attributes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment