Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am building a new control in wpf c#. I have the following Dependency property


C#
[TypeConverter(typeof(LengthConverter))]
[LocalizabilityAttribute(LocalizationCategory.None, Readability = Readability.Unreadable)]
[Description("Gets or sets the dropdown height when control is initiated")]
public Double DropDownHeight
{
    get { return (Double)this.GetValue(DropDownHeightProperty); }
    set { this.SetValue(DropDownHeightProperty, (object)value); }
}


It works perfectly fine and I can even use "Auto" as property because of the converter. my question is

1) what should the editor attribute look like to have the "Set Auto" button function displayed next to the property in the Properties Toolbar in Visual studio 2012?

2) is there a available list of all the editor attributes that comes standard with VS2012, so you don't have to create your own?

ps. I haven't compiled an editor attribute before or cared much for the "look" at the design time before, so my knowledge on this is somewhat limited - any help will be appreciated.
Posted

1 solution

you'll need design-time assembly and custom property editor, something like this. Note, it might be time-consuming and complicated, and to work correctly, design-time assemblies should be registered in registry. So, if you can live without it, leave it
 
Share this answer
 
Comments
Jan Lehmkuhl 12-Jul-13 8:08am    
Thanks Irina. I am definitely not interested in designing my own at this point in time unless it wasn't time consuming. But is there a way to access those that are currently already created? i.e. If you look at the height property of any control, you will notice a "button" next to the textblock that will automatically set the value to auto. Or look at the Grid options has 2 textboxes. Is there a way that I can add 1 line of code (i.e. an Attribute above my property that tells VS that this property above for instance should look the same as a normal Height property used by other controls?
Irina Pykhova 12-Jul-13 8:56am    
I haven't seen any. I think, they are defined in some Visual Studio assemblies, which are not supposed to be public.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900