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

Custom Property

6 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 25 Aug 2008, 05:26 PM
We have a need for a custom property on a textbox.  I have found how to create a custom RadProperty, but I do not know how to attach it to all of the textboxes in the application.  Is there a tutorial or something that we could follow for this functionality?

Thanks

6 Answers, 1 is accepted

Sort by
0
Mike
Telerik team
answered on 28 Aug 2008, 07:39 AM
Hello Tony,

The basic definition of RadProperties is close to DependencyProperties you would find in WPF, but there are also some differences. Even though it is possible to use RadProperty in terms of "attached" property this functionality is designed for very specific scenarios and it is not widely used in TPF. Another important thing to consider is that RadProperties can be declared on RadObjects only. Can you please elaborate a bit more on your scenario?

 
Sincerely yours,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ryan
Top achievements
Rank 1
answered on 28 Aug 2008, 04:11 PM
I also need to have this question answered.

Once I understand how to add custom properties to a rad control, how do I set my application to automatically add the custom property to all rad controls.
0
Mike
Telerik team
answered on 29 Aug 2008, 12:26 PM
Hello Ryan,

I'll be glad to help you with this and I'll appreciate more details on what functionality you are trying to achieve in terms of adding custom properties to RadControls.
 

Sincerely yours,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ryan
Top achievements
Rank 1
answered on 29 Aug 2008, 01:29 PM
I'd like to add to a radcontrol a new property. For instance, I'd like to add a propery to a radcontrol called "Error" or "CurrentState" or "Validate". I want to set the new property a string value. This property could be set at design time or could be set programatically.

But more than that, I want to add the new property (or properties) to all the radcontrols...not just one.

1. Can you suggest an efficient way of doing this?

2. Can you also let me know of any issues that may come up while doing this? (For instance, I believe that there is a know issue with themes affecting controls that are based on themed-radcontrols.)

Thanks in advance,

Ryan

0
Mike
Telerik team
answered on 29 Aug 2008, 04:24 PM
Hi Ryan,

Thank you for explaining this. This is a bit of unusual request and we need some time to gather and provide you with some instructions. Expect a reply tomorrow or the day after.


Kind regards,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vassil Petev
Telerik team
answered on 01 Sep 2008, 03:59 PM
Hello Ryan,

It is possible to declare a RadProperty of a RadObject, for example MyCustomRadItem, and to "attach" it to other RadItems, i.e. to define a value for that property that corresponds to specific RadItem. This would be similar to using the internal property values hash-table of each RadItem to store values for properties that do not belong to this item. But you can actually implement this functionality very easily by declaring a static dictionary to store values corresponding to different controls. A property of component simply does not make sense without the underlying logic for the control's behavior according to the value of that property. And you would not be able to modify the control's logic with RadProperties, except by inheriting (or extending) the control.

Though, I believe, using attached RadProperties is not actually the best approach to achieve what you need.
There is a special feature in Windows Forms designed for your case, which I think you should consider: Extender Providers. This feature can help you extend the properties of any components in VS designer, and access the values defined for these properties. This is the same functionality used for toolbox components like ErrorProviders, ToolTips and other. If you are not familiar with this approach, please review the following MSDN article: http://msdn.microsoft.com/en-us/library/d6c1xa43.aspx


All the best,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Tony
Top achievements
Rank 1
Answers by
Mike
Telerik team
Ryan
Top achievements
Rank 1
Vassil Petev
Telerik team
Share this question
or