在写windows phone自定义控件遇到的问题,请高手解答

     我是一个书上看到的自定义用户控件的例子,但是这个书没讲明白。我有一点很不理解。如下为控件最后生成的图片

是正常的。

下面是控件类内容

public class MyCustomControl : ContentControl
{
public static readonly DependencyProperty MyIconProperty =
DependencyProperty.Register("MyIcon", typeof(ImageSource), typeof(MyCustomControl), null);
public MyCustomControl()
{
DefaultStyleKey = typeof(MyCustomControl);
}
public ImageSource MyIcon
{
get { return base.GetValue(MyIconProperty) as ImageSource; }
set { base.SetValue(MyIconProperty, value); }
}
}

有点我很不理解,就是在用xaml写样式的时候,这个样式的文件名必须叫generic,而且必须包含在Themes文件夹是,这个文件夹的名字也不能改变。写的时候给文件随便起个其它名字,样式就不起作用了。这是为什么呢,如下图我划红线的文件夹和,文件名。

请高手解答。

下面是项目源码链接    https://files.cnblogs.com/learnWindowsPhone/PhoneClassLibrary1.zip

原文地址:https://www.cnblogs.com/learnWindowsPhone/p/2412436.html