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

Create Custom Editor in AutoGeneratingPropertyDefinition Event

11 Answers 180 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
WILLIAM
Top achievements
Rank 1
WILLIAM asked on 03 Jan 2012, 02:49 PM
Can you point me in the direction of a sample that creates a CustomEditor in the AutoGeneratingPropertyDefinition Event?
Thanks.

11 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 03 Jan 2012, 03:20 PM
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 >>

0
WILLIAM
Top achievements
Rank 1
answered on 03 Jan 2012, 03:41 PM
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.
0
Vanya Pavlova
Telerik team
answered on 03 Jan 2012, 04:50 PM
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 >>

0
WILLIAM
Top achievements
Rank 1
answered on 03 Jan 2012, 05:01 PM
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.
0
Ivan Ivanov
Telerik team
answered on 06 Jan 2012, 11:09 AM
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 >>
0
WILLIAM
Top achievements
Rank 1
answered on 06 Jan 2012, 02:16 PM
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.
0
Ivan Ivanov
Telerik team
answered on 06 Jan 2012, 02:22 PM
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 >>
0
WILLIAM
Top achievements
Rank 1
answered on 06 Jan 2012, 02:29 PM
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.
0
WILLIAM
Top achievements
Rank 1
answered on 06 Jan 2012, 03:41 PM
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.
0
Ivan Ivanov
Telerik team
answered on 06 Jan 2012, 04:29 PM
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 >>
0
WILLIAM
Top achievements
Rank 1
answered on 06 Jan 2012, 04:31 PM
Ivan,
That's great news, I'm glad that the exception report helped. Thanks for the follow up.
Regards.
Tags
PropertyGrid
Asked by
WILLIAM
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
WILLIAM
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or