Modify PropertyTemplate?

Thread is closed for posting
2 posts, 0 answers
  1. Manfred
    Manfred avatar
    54 posts
    Member since:
    Jan 2011

    Posted 30 Jul 2012 Link to this post

    Hi there,

    is it possible, to change the template which was called if I selected 'JustCode - Create Get/Set Property' in the context menu?
    I use my own ViewModelBase and I want to use it like this:
    /// <summary>
    /// Gets or sets the country.
    /// </summary>
    /// <value>The country.</value>
    public string Country
   = value;
    I only want to add one line to the setter.
    Is it possible to change that template?

    Best Regards
  2. Ivan
    Ivan avatar
    106 posts

    Posted 02 Aug 2012 Link to this post


    Thank you for your feedback. JustCode "Create Property" command does not support the scenario you described. However, you can write an extension for JustCode which does this. I created a working extension following your description and I am attaching the solution.
    You can modify it further if you want - for example change/remove the shortcut, the text that will be shown and the identifier. This command can be executed on a field and will create a property which have "OnChange" in its setter.
    You can go even further and make it to check whether the new value is different than the old one and call OnChange only then.
    In order to get this extension working you have to build the solution, then copy the dll and pdb file, go to (Program Files)/Telerik/JustCode/Libraries and create "UserExtensions" folder. Finally, paste the dll and the pdb in this folder and start a new instance of Visual Studio.
    If you want to debug the extension just start debugging in the solution I am sending you.
    If you have any questions regarding JustCode and its API, please do not hesitate to contact us again!

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top