Earlier this year, I talked about how I hadn’t yet seen the need for using the Custom Controls Everywhere approach in XAML. I said, “Just use the controls you have, apply styles, and attach properties and behaviors. And if you find a case where this falls short, let me know!”
Well, today, Rick Strahl had a tweet:
What's the best way to provide cell padding in the Silverlight grid control? Apply margins to all cell child controls?
To which I replied:
Yeah, unfortunately, margins on all child controls. Or, create a custom Grid control that derives from Grid, and add padding.
There ya have it: evidence that a custom Grid control would have been handy. I’ve actually seen some other hints at the Custom Controls Everywhere need in XAML over the last few months, and I’ve heard of people creating custom controls in Silverlight pretty often.
So I think I need to resume preaching Custom Controls Everywhere, regardless of the UI platform. I should have listened to my gut more than my head on this one. Custom Controls Everywhere will never hurt you, it can only help you. I implore you to start wrapping the stock controls with your own. You will thank me for it eventually, I promise you. :-)
If you aren’t familiar with my Custom Controls Everywhere concept, here are some of my posts on the subject:
- Overview of the concept
- Custom Controls Everywhere Saves the Day
- Custom Controls Everywhere is Cheap