none
Possible to have a class derive from Grid *and* be templated? RRS feed

  • Question

  • I've got a class called DashboardButton that simply derives from Grid and has a few key methods and events. I derived from Grid because users should be able to put whatever visuals they want inside an empty DashboardButton container. However, I'd also like to be able to provide a couple "out of the box" Dashboard Buttons with nifty styles and colors applied. All cases of the button should leverage the same code.

    I'm having a brain cramp here... how do I accomplish this? I tried making a separate class deriving from DashboardButton, but since DashboardButton is a Grid it seems I don't have the ability to set up a template with generic.xaml and such.

    Thursday, October 14, 2010 1:48 AM

All replies

  • Hmm, I kinda-sorta answered my own question (told you it was a brain cramp!). I realized all I needed to do was create multiple styles in generic.xaml with a TargetType of DashboardButton and then each instance of DashboardButton can be pointed to whatever style resource I want. The problem now is, after I compile the DashboardButton project and try to reference it from a separate Silverlight application, the SL app doesn't "see" the additional styles I created.
    Thursday, October 14, 2010 3:04 AM