This is a migrated thread and some comments may be shown as answers.

Creation of Custom Editor just like ITypeEditor Of Codeplex

5 Answers 122 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Imran
Top achievements
Rank 1
Imran asked on 28 May 2014, 12:05 PM
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.

5 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Ivanov
Telerik team
answered on 28 May 2014, 12:33 PM
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.
 
0
Imran
Top achievements
Rank 1
answered on 29 May 2014, 04:54 AM
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
0
Ivan Ivanov
Telerik team
answered on 02 Jun 2014, 03:44 PM
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.
 
0
Imran
Top achievements
Rank 1
answered on 03 Jun 2014, 06:03 AM
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.
0
Ivan Ivanov
Telerik team
answered on 04 Jun 2014, 12:37 PM
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.
 
Tags
PropertyGrid
Asked by
Imran
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Imran
Top achievements
Rank 1
Share this question
or