Creation of Custom Editor just like ITypeEditor Of Codeplex

6 posts, 1 answers
  1. Imran
    Imran avatar
    10 posts
    Member since:
    May 2014

    Posted 28 May 2014 Link to this post

    Hi Team,'

    Could you please help me out, How Can I create a Custom Editor for rendering the Items in the RadPropertyGrid, I want a behaviour similiar to ITypeEditor of Codeplex propertyGrid.

    1) I load the property Grid with the objects that are created on runtime.
    2) I want to  create a button  adjacent to  those properties in the propertyGrid which are boolean only.

    Please help me out.
  2. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 28 May 2014 Link to this post

    Hi,

    Can you please provide an extensive description of your scenario, so that we can search for a possible solution with the current version, or think of a possible future feature?

    Regards,
    Ivan Ivanov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Imran
    Imran avatar
    10 posts
    Member since:
    May 2014

    Posted 28 May 2014 in reply to Ivan Ivanov Link to this post

    Hi Ivan,

    Its like this.
    I creating an Employee Object dynamically, I dont have the information on this object at Runtime, but  create the employee Object at Runtime using Reflection.Now I am using this Emplyee Object to bind it to radProperty Grid.

    I am able to bind the object to the grid, but we have a specific requirement, We want to show a button inside a panel for those properties which are of boolean type(As shown in the image u could see a button against the boolean properties towards the right hand corner).
    I am able to do this by creating a Custom Editor of ItypeEditor type of Codeplex and create my own button programmatically within resolveEditor Method.

    I want to have this functionality using Telerik RadPropertyGrid. Please help
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 02 Jun 2014 Link to this post

    Hi,

    We have a slightly different approach in terms of defining custom editors. You can use a DataTemplateSelector that assigns different custom DataTemplates, in accordance to the property type. In the SelectTemplate method, you can check PropertyDefinition.SourceProeprty.PropertyType and if it is typeof(bool), you can return your custom control, defined in a DataTemplate.

    Regards,
    Ivan Ivanov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Imran
    Imran avatar
    10 posts
    Member since:
    May 2014

    Posted 03 Jun 2014 Link to this post

    Thanks Ivan,

    Actually I have implemeted the EditorTemplate property for the propertydefinitions and assigned my data template to it.
    But I want a behavior like, when the property is boolean and has some specific attribute(bindable etc..) then it should be highlighted as Red in the grid.
    Then the users provides the value for the property and refreshes the grid then the value should be Green and updated with the new value.
    Actually its not only enriching the UI using dataTemplate but also involves a lot of interactions between the template and its property at runtime.

    If this is possible could you please provide any sample code for that.
  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 04 Jun 2014 Link to this post

    Hi,

    Well, you can treat the DataTemplate as the blueprint that is used to create your editor. At the point, when SelectTemplate is invoked, the editor is not yet created. Thus, you cannot modify the editor then (add the red highlighted border i.e). However, you can define two alternative templates: one with the highlighting and one without it. Then you can read the PropertyDefinition's SourceProperty CustomAttributes and decide which of the templates should be used. As for changes that will happen at runtime, you can "respect" them with DataBinding (i.e. bind the foreground to some property's value - when it changes, the foreground brush changes too). Please, be advised that as soon as the editor is loaded, RadPropertyGrid will assign its Item as the editor's DataContext.

    Regards,
    Ivan Ivanov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready