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

How to dynamically add or remove properties

10 Answers 460 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Jackey
Top achievements
Rank 1
Jackey asked on 28 Jan 2015, 08:06 AM
Hi team,

Say class A has a property which is a collection of Class B. Now i want to design a UI attached. 

So I wonder if propertygrid has such a built support, if not, how am i gonna do this? A self defined a data template for the property?

10 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 28 Jan 2015, 09:59 AM
Hello Jingfei,

Generally, RadPropertyGrid will generate a CollectionEditor for a property of type collection. If you want to modify the behavior, you can work in an unbound mode and specify the bindings on your own. The article for "Unbound Mode" will be probably a useful resource in this case. 
Still, let us know in case you need further assistance. 


Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jackey
Top achievements
Rank 1
answered on 28 Jan 2015, 01:31 PM
Hi Maya,
Thanks for your reply. Now i realize i need to use RadDataForm to edit a collection of objects of A, and for each object of A, i stil have the requirements as above. Then how do i do? And the property is a virtual as requried by Entity frameork. And i found RadDataForm can't recoginze them.
0
Maya
Telerik team
answered on 28 Jan 2015, 01:59 PM
Hello Jingfei,

If RadDataForm is a more appropriate control, you can follow its documentation for a reference on how to define custom fields. I guess the "Customized Fields"  and "Defining Custom DataFields" articles will be quite helpful.

Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jackey
Top achievements
Rank 1
answered on 28 Jan 2015, 03:24 PM
Hi Maya,

I followed customized fields, however, it didn't work. It shown nothing for one object A. it worked for auto-generated fields.

Could you give me an example? I mean a complete solutions(VS)

Thanks,
jingfei
0
Accepted
Maya
Telerik team
answered on 28 Jan 2015, 05:24 PM
Hello Jingfei,


You can find an example in our SDK repository. The one I think will be most helpful is DefiningCustomDataFields.

Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jackey
Top achievements
Rank 1
answered on 29 Jan 2015, 01:18 PM
Hi Maya,
Thanks for the github project. It helped a lot. However, in my implementation, when i clicked the new item symbol of data form controls, all the data fields were not blank, they seemed to inherit values from the previous shown ones. And when i clicked ok, in my backend, it would save to db. However, the db's values are all null for string, 0 for integers. It very confuses me a lot. I expect the new item would give a blank data field for me to input something. 

Thanks,
Jingfei
0
Maya
Telerik team
answered on 29 Jan 2015, 05:02 PM
Hello Jingfei,

This sounds a bit strange. Will it be possible to update the project from the github so that it illustrates your scenario and reproduces the behavior and send it back to me ? In that way I will be able to debug it on my side and suggest a solution.

Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jackey
Top achievements
Rank 1
answered on 30 Jan 2015, 02:39 AM
Hello Maya,

Before repro that issue, can I make a wild guess is it because i use a DB<Set> to bind to the DataForm control?

Thanks,
Jingfei
0
Jackey
Top achievements
Rank 1
answered on 30 Jan 2015, 03:48 AM
One thing to add, when I wrap the DBSet with ObservableCollection, then the problem is gone. So DBSet is to be blamed
0
Maya
Telerik team
answered on 30 Jan 2015, 08:04 AM
Hi Jingfei,

I am happy to see that you resolved the issue you had. Let us know in case we can be of any further assistance.

Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PropertyGrid
Asked by
Jackey
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jackey
Top achievements
Rank 1
Share this question
or