Using custom control's alias in XAML?

You could write a simple empty wrapper class, which would inherit the control you currently use. Then in XAML you would use this wrapper instead of the specific CustControl. At any time, you could change the base class for the wrapper at one single place.

Up vote 0 down vote favorite share g+ share fb share tw.

In a WPF (Silverlight) UserControl I have lots of custom control instances: ... ... ... In MyProject I have not only the CustControl implemented, but also the CustControl1, the CustControl2, the CustControl3 and the like. Sometimes, I have to use another custom control type in the UserControl. Can I have only one place for changing custom control's name instead of changing it in all the numerous references in the XAML?

In other words, can I use an alias for those multiple custom control references inside my XAML and one place where I define the real CustomControl class' name for that alias? Or maybe some other approach for solving this problem? Wpf silverlight xaml custom-controls link|improve this question asked Feb 11 '11 at 20:57rem1,96332059 98% accept rate.

You could write a simple empty wrapper class, which would inherit the control you currently use. Then in XAML you would use this wrapper instead of the specific CustControl. At any time, you could change the base class for the wrapper at one single place.

But I must say: this design stinks. Are you sure you couldn't solve this issue with global styles/templates for one CustControl class?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions