views:

149

answers:

1

How do I reference the default style that appears in generic.xaml?

I am trying to create a static class that returns known styles for a custom control. I know how to pull the styles that exist in App.xaml, but I'm not sure how to grab the generic one.

public static class VehicleTypes
{
    public static readonly Style SportsCar = /*???Default style for VehicleIcon from generic.xaml*/;

    public static readonly Style Sedan = Application.Current.Resources["SedanStyle"] as Style;
    public static readonly Style Jeep = Application.Current.Resources["JeepStyle"] as Style;
    ...
}

Thanks!

A: 

As far as I can tell you can't get the default style.

It may be possible if you use a bit of trickery to get the private member _dictionary from the ResourceDictionary and then find all the styles for a control.

What do you need to do with the default style? maybe there is another option.

Graeme Bradbury