Hi,
I have created a custom control with Textbox having properties values as AcceptsReturn="True" TextWrapping="Wrap" so that it will acts as Multi line Textbox. I used this control as Editor for one of the Property which binds to PropertyGrid and Editor Style as DropDown.
I have problem here,whatever I write in the textbox once dropdown closed it should be visible in propertyValue but it is not showing the value.How to achieve this??
I am asking similar to TimePicker where once we select time it will be shown in PropertyValue.
Regards,
Nagasree.
4 Answers, 1 is accepted
I have created a sample project that implements the desired behavior. Please review it and update me whether it is useful.
Regards,
Stefan Nenchev
Telerik by Progress
Hi Stefan,
I am not able to run the attached project.It is giving error the mentioned Resource dictionaries are not available.I have .Net Framework 4.5.
But I saw your code I understood that you are overriding the ToString() method of the class to return the FirstName value so that we get that value in the PropertyGrid. This approach is not feasible for me. I have two fields where I am using this usercontrol in the same class with which property value I have to return in ToString() method.
Can't We use TypeConverter?? I tried to use it but I am not successful.
Regards,
Nagasree.
Reapplying the references at your end should fix the issue with the Resource Dictionaries. However, I have recreated the sample for your convenience. Actually the ToString() method should not affect the EditorAttribute. Please review the code-behind of the CustomControl where a dependency property is added which eventually is set as the TargetProperty in the EditorAttribute. Please try applying such approach at your end as well.
Regards,
Stefan Nenchev
Telerik by Progress
Hi Stefan,
It is working as expected.Thank you.
Regards,
Nagasree