Click here to Skip to main content
15,903,681 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am trying to add a new iamge property to one of my customcontrols. This property should give a preview of the image during designtime. The images should be selectable with a dropdown box or something like that.

The things I found are all for Forms and not for wpf.
(e.g [Editor(typeof(ImageTypeEditor),typeof(UITypeEditor))]).

An other way I found is for wpf. It is an example in "Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4". In this example they made use of an class which implemts PropertyValueEditor (in the case of the example not for Images but doubles and strings). This class is then used analog to the following:
AttributeTableBuilder builder = new AttributeTableBuilder();
builder.AddCustomAttributes(typeof(MyControl), "MyImageProperty", new EditorAttribute(typeof(MyImageproperyValueEditor), typeof(PropertyValueEditor)));
MetadataStore.AddAttributeTable(builder.CreateTable());


Is there an easy way to realize this in an easy way with the wpf? Or can anyone give some code examples.

Thanks a lot!
Posted

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