Using custom properties with Controls

Posted by Community Admin on 04-Aug-2018 12:30

Using custom properties with Controls

All Replies

Posted by Community Admin on 09-Oct-2013 00:00

I began to develop a new project for Sitefinity 6.1, the previous version was on version 3.
I have a question about custom properties. Here is an example:

public class TestWidget : SimpleView
   
        [Category("General")]
        public string Name get; set;

        [Category("General")]
        public SubModel SubModel get; set;
        .....
   
public class SubModel
   
        [Category("Additiona")]
        public string FirstName get; set;

        [Category("Additiona")]
        public string LastName get; set;

        [Category("Additiona")]
        public string Description get; set;
   

What can I do with the field  
        [Category("General")]
        public SubModel SubModel get; set;

In version 3, we had the attributes:
    [WebEditor("SomeEditorPath, SomeAssembly")]
    [TypeConverter("SomeConverterPath, SomeAssembly")]

But the new version is not possible to thereby to implement properties.
Of course I looked at the links about custom widgets(www.sitefinity.com/.../anatomy_of_a_sitefinity_4_widget   and  www.sitefinity.com/.../creating_advanced_sitefinity_4_widget_control_designers)

If I understood correctly you have to offer for each widget create a CustomDesigner(heir ControlDesignerBase) and other file. Is there no other way to use our design field for a single field without creating a lot of unwanted files to the widget?

Please tell me the best solution to this problem.

Posted by Community Admin on 09-Oct-2013 00:00

Hi Max,

I think if you don't create a designer the widget should still work: if you press the edit link in design time you just get a basic designer showing all properties, which can be filled with a string value.

You can user Sitefinity Thunder to create a widget, or a designer for an existing widget. I would not recommend to create a designer manually from scratch. It's a very error prone process in my opinion.

Posted by Community Admin on 09-Oct-2013 00:00

Maybe I asked the wrong question. Yes, of course it will work and will create a text field for the "submodel".
My question is: I want to use the default design for the widget but "submodel" use my own design of the control as it was possible in version 3.

This thread is closed