How to dynamically add or remove properties

11 posts, 1 answers
  1. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 28 Jan 2015 Link to this post

    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?

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Jan 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 28 Jan 2015 in reply to Maya Link to this post

    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.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Jan 2015 Link to this post

    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.

     
  6. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 28 Jan 2015 in reply to Maya Link to this post

    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
  7. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Jan 2015 Link to this post

    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.

     
  8. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 29 Jan 2015 in reply to Maya Link to this post

    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
  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 29 Jan 2015 Link to this post

    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.

     
  10. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 29 Jan 2015 in reply to Maya Link to this post

    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
  11. Jackey
    Jackey avatar
    71 posts
    Member since:
    Oct 2014

    Posted 29 Jan 2015 in reply to Maya Link to this post

    One thing to add, when I wrap the DBSet with ObservableCollection, then the problem is gone. So DBSet is to be blamed
  12. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 30 Jan 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready