locked
Add Custom Properties and Property Editors to HTML Elements selected in the HTML Editor RRS feed

  • Question

  • Is it possible to add custom properties with a custom UITypeEditor  to the selected html element in the HTML editor. I have read some posts about modifying the intellisense xsd files in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\schemas\html which looks promising but it does not look like there is a way to specify the property editor (UiTypeEditor). There is the vs:builder property that that looks like it only has support for predefined values (e.g. style, color, etc). Is this possible either using this method or by some other method? Thanks.
    Tuesday, August 13, 2013 4:53 AM

Answers

All replies

  • Hi Greg Horvath,

    The UITypeEditor class provides a base class that you can derive from and extend to implement a custom type editor for the design-time environment. Typically, your custom type editor interacts with the PropertyGrid control.

    To implement a custom design-time UI type editor, you must perform the following steps:

    • Define a class that derives from UITypeEditor.

    • Override the EditValue method to handle the user interface, user input processing, and value assignment.

    • Override the GetEditStyle method to inform the Properties window of the type of editor style that the editor will use.

    When your UI type editor is ready for use in your custom control, attach the class deriving from the UITypeEditor base class to a property, implement the property based on the custom type you have de

    When you develop your custom UITypeEditor, it is recommended that you set the build number to increment with each build. This prevents older, cached versions of your UITypeEditor from being created in the design environment.fined, and apply the EditorAttribute to the property.

    For more information,please refer to UITypeEditor Class and Implementing a UI Type Editor .

    The following is the related topic:

    Adding Custom Attributes to HTML Elements

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards.

    Jane.


    Jane Wang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 14, 2013 9:24 AM
  • Thank you for the information on UITypeEditor, however I think you misunderstood what I was asking for. I understand how to use UI type editors, the problem I am facing is that there is no way to expose new properties on elements to the visual studio Properties window. What I would like is for the non standard properties on my html elements to be displayed in the property editor.
    Saturday, August 17, 2013 2:54 AM
  • Hi Greg Horvath,

    Thank you for your feedback.

    The custom properties are created with custom UITypeEditor,so I thought that the key point to add them to the Properties window is about Implementing a UI Type Editor .

    I assume that you have used UITypeEditorEditStyle Enumeration to specify identifiers that indicate the value editing style of a UITypeEditor.

    Then,please try the methods of IWindowsFormsEditorService Interface,which provides an interface for a UITypeEditor to display Windows Forms or to display a control in a drop-down area from a property grid control in design mode.

    Please note that the IWindowsFormsEditorService is only available through the GetService method of the PropertyGrid control.

    Please refer to the following links for the sample code:

    Creating Property Editors in DesignTime for VS.Net Easily (UITypeEditor Helper)

    A UITypeEditor for easy editing of flag enum properties in the property browser

    Best Regards.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 19, 2013 5:48 AM
  • You still seem to be missing the point of my question. The UITypeEditorAttribute needs to be applied to a property. I am asking how to extend the existing object that is shown for html elements in the HTML editor in order to display additional properties. For example, the image below shows the default visual studio properties for div tag. What I am after is how to extend these properties eg. add a property called "CustomProperty" that will appear in the visual studio properties window. If I can figure out how to do this I can apply the ui type editor to the extended object, but currently I have no way to add additional properties.

    Monday, August 19, 2013 4:32 PM
  • Wednesday, September 4, 2013 12:56 AM
  • Marking this thread as Closed.
    Thursday, September 12, 2013 11:55 PM