引用Silverlight中控件的默认样式

问题描述:

如何引用generic.xaml中显示的默认样式?引用Silverlight中控件的默认样式

我想创建一个静态类,它返回一个自定义控件的已知样式。我知道如何拉取App.xaml中存在的样式,但我不确定如何抓取通用样式。

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; 
    ... 
} 

谢谢!

据我可以告诉你不能得到默认样式。

如果您使用一些技巧从ResourceDictionary中获取私有成员_dictionary,然后找到控件的所有样式,则可能是可能的。

你需要怎样处理默认样式?也许还有另一种选择。