Extend properties of Silverlight controls...
-
I want to add some custom properties as well as the existing properties should remain same in the controls. Some of the controls can have the extended properties, but some controls like Textblock are sealed so can not be able to inherit other controls from the existing control. Anybody have any idea that how can we extend the exisiting silverlight control's properties? Thanks in advance...
-
I want to add some custom properties as well as the existing properties should remain same in the controls. Some of the controls can have the extended properties, but some controls like Textblock are sealed so can not be able to inherit other controls from the existing control. Anybody have any idea that how can we extend the exisiting silverlight control's properties? Thanks in advance...
If you want to extend an existing control, I'd look to use an Attached Property.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
If you want to extend an existing control, I'd look to use an Attached Property.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
I have tried it with two ways: 1. Inheriting from teh existing control and add our custom property to it, include it in the xaml page as a new namespace and use it. But it is not working in the case when the control class is sealed for example Textblock.... 2. Created a wrapper class having the TextBlock and my custom property.Initialize the Textblock in constructor,include it in the xaml page as a new namespace and use it. But it is also not working in the case when we give the "x:name" to that control... No other idea how to do?
-
I have tried it with two ways: 1. Inheriting from teh existing control and add our custom property to it, include it in the xaml page as a new namespace and use it. But it is not working in the case when the control class is sealed for example Textblock.... 2. Created a wrapper class having the TextBlock and my custom property.Initialize the Textblock in constructor,include it in the xaml page as a new namespace and use it. But it is also not working in the case when we give the "x:name" to that control... No other idea how to do?
As I said - I'd use an Attached Property[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
As I said - I'd use an Attached Property[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
I have tried this link http://geekswithblogs.net/Silverlight2/archive/2008/10/31/developing-custom-controls-in-silverlight-2.aspx[^] But I am not getting the existing properties of the control.... :(
I'm not sure how many different ways to say this. Perhaps I need to shout here. USE ATTACHED PROPERTIES. That's it - full stop, finito. That's the WPF/Silverlight way of doing things. There are very few instances where you need to subclass existing controls.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
I'm not sure how many different ways to say this. Perhaps I need to shout here. USE ATTACHED PROPERTIES. That's it - full stop, finito. That's the WPF/Silverlight way of doing things. There are very few instances where you need to subclass existing controls.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
Pete O'Hanlon wrote:
USE ATTACHED PROPERTIES. That's it - full stop,
:) easy, pete. sometimes, people just don't listen. :)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Pete O'Hanlon wrote:
USE ATTACHED PROPERTIES. That's it - full stop,
:) easy, pete. sometimes, people just don't listen. :)
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)