• 在写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

  • 相关阅读:
    redis配置认证密码以及远程访问
    Mybatis缓存配置
    Node.Js安装
    1.ArcGis几何图形之几何计算
    MessagePack 新型序列化反序列化方案
    Redis(六)-数据类型
    Redis(五)-数据库
    Redis(四)-配置
    Redis(三)-Ubuntu下安装
    Redis(二)-Win系统下安装
  • 原文地址:https://www.cnblogs.com/learnWindowsPhone/p/2412436.html
Copyright © 2020-2023  润新知