+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Using custom properties with Controls

Using custom properties with Controls

3 posts, 0 answered
  1. Max
    Max avatar
    2 posts
    Registered:
    24 Sep 2013
    09 Oct 2013
    Link to this post
    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(http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2011/09/01/anatomy_of_a_sitefinity_4_widget   and  http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2011/09/20/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.
  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    09 Oct 2013 in reply to Max
    Link to this post
    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.
  3. Max
    Max avatar
    2 posts
    Registered:
    24 Sep 2013
    09 Oct 2013
    Link to this post
    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.
3 posts, 0 answered