Custom Property

7 posts, 0 answers
  1. Tony
    Tony avatar
    14 posts
    Member since:
    Jul 2008

    Posted 25 Aug 2008 Link to this post

    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
  2. Mike
    Admin
    Mike avatar
    640 posts

    Posted 28 Aug 2008 Link to this post

    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.
  3. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jul 2008

    Posted 28 Aug 2008 Link to this post

    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.
  4. Mike
    Admin
    Mike avatar
    640 posts

    Posted 29 Aug 2008 Link to this post

    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.
  5. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jul 2008

    Posted 29 Aug 2008 Link to this post

    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

  6. Mike
    Admin
    Mike avatar
    640 posts

    Posted 29 Aug 2008 Link to this post

    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.
  7. Vassil Petev
    Admin
    Vassil Petev avatar
    1765 posts

    Posted 01 Sep 2008 Link to this post

    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.
Back to Top