Create Custom Editor in AutoGeneratingPropertyDefinition Event

12 posts, 0 answers
  1. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 03 Jan 2012 Link to this post

    Can you point me in the direction of a sample that creates a CustomEditor in the AutoGeneratingPropertyDefinition Event?
    Thanks.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 03 Jan 2012 Link to this post

    Hi,

     

    You may take a look at the following thread "Editor DataTemplate" for further reference. 
    Will you please give it a try and let me know how it goes?
    I believe that the same approach is applicable to Silverlight as well. 



    Greetings,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 03 Jan 2012 Link to this post

    Thanks for the reply. My understanding is that the FrameworkElementFactory is not available in Silverlight. I've been attempting to use the Load method on XamlReader to build out the appropriate DataTemplate. But, have not yet been successful. Is it possible to get a simple demo like the WPF example, with a RadNumericUpDown?
    Thanks.
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 03 Jan 2012 Link to this post

    Hi,

     
    In Silverlight you may also store the specified DataTemplate (entirely in XAML) within UserControl's Resource Collection and reference it in code-behind, instead of using the XamlReader.Load method. If you encounter any difficulties in referencing the specified DataTemplate you may submit a support ticket with your application contained in it. We will use it for local testing and we would be able to provide you with an appropriate solution. 



    Greetings,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 03 Jan 2012 Link to this post

    My intention was to avoid specifying the DataTemplate(s) in a ResourceCollection. This approach would have me duplicating the DataTemplates across multiple Views. I am currently experiencing a NullArgumentException (dp parameter is Null). This is an exception happening beyond my code, and I suspect that "dp" is referring to a DependencyProperty that is null nested somewhere beyond my code.

    If you are able to create a simple demo, that would help alot. Building a sample will take a fair amount of work, because of all that I will have to extract. Any help is greatly appreciated.
    Thanks.
  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 06 Jan 2012 Link to this post

    Hello William,

    You do not have to duplicate the resource dictionary that contains the mentioned DataTemplates. Initializing it in App.xaml will set it in the global resource scope of your applcaition. Please, let me bring to your attention that we are going to introduce a mechanism for reusing DataTemplates with our next official release, which I believe will prove rather useful in your scenario. As for the issue that you have described, would it be possible for you to send us a sample project that reproduces it, so that we could debug it on our side and give you an appropriate solution for it.

    Regards,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  8. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 06 Jan 2012 Link to this post

    Ivan,
    Thanks for the feedback, and direction towards placing common resources in App.xaml. We definitely look forward to the future release that will add functionality to the RadPropertyGrid.

    Regarding uploading a sample project, I did spend some time trying to put together a sample application. Unfortunately, it involves a fair amount of our base framework, something that I cannot easily parse out. We are using the property grid with a .Net DynamicObject, and I suspect that may be where part of the problem lies. I'm hopeful that a new release, along with sharing DataTemplate definitions in the App.xaml, will help us get past our problems.
    Thanks.
  9. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 06 Jan 2012 Link to this post

    Hi William,

    Would it be possible for you to post at least the stack trace of this exception?

    Greetings,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  10. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 06 Jan 2012 Link to this post

    Ivan,
    Thanks for the quick reply. One of the difficulties with this particular exception is that it brings everything to a halt, leaving me with no stack to look through, no nested exceptions, no line of code, etc. I will reproduce for you and send you what I do get.

    I believe it has something to do with the Binding, as the exception references a null property named "dp", which I believe is an abbreviation for DependencyProperty.
    Thanks.
  11. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 06 Jan 2012 Link to this post

    Ivan,
    I've attached a screenshot that shows the exception we are seeing. Some comments;
    1. The Property with which we are having a problem is the "BMI" property. I get the attached exception when I modify the value and tab away.
    2. The first hint of a problem is that the data is not bound. Currently, the value for BMI starts off as ZERO. The BMI property should actually show a value of 123.
    3. The remaining properties (Birthdate, FirstLastName, etc) are all being bound via the RadPropertyGrid's AutoGenerate feature.
    Let me know if you have any questions.
    Thanks.
  12. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 06 Jan 2012 Link to this post

    Hello William,

    Actually these clarifications helped a lot. I have managed to reproduce the exception. As Silverlight 4 does not support binding to DynamicObject, we have implemented our own mechanism that mimics the default TwoWay binding behavior, in order to tackle this framework limitation. Unfortunately, it is impossible for us to guess the custom logic behind every DataTemplate that might be set as EditorTemplate, so RadPropertyGrid does not supports custom DataTemplates when it is bound to a DynamicObject instance. We have some ideas for introducing a solution to this problem, but for now you should rely only on the default editors. However, we will fix the exception with our next internal build, which will be available in the beginning of the next week.

    Greetings,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  13. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 06 Jan 2012 Link to this post

    Ivan,
    That's great news, I'm glad that the exception report helped. Thanks for the follow up.
    Regards.
Back to Top
DevCraft banner