wpf DependencyProperty不接受Image Imagesourc的默认值

时间:2014-01-04 18:46:45

标签: c# wpf

我正在为图像路径编写依赖属性 它显示参数异常默认值类型与属性类型

不匹配
[Description("Set image path for button "), Category("Common Properties")]
public ImageSource ImagePath
{
    get { return (ImageSource)GetValue(ImagePathProperty); }
    set { SetValue(ImagePathProperty, value); }
}

// Using a DependencyProperty as the backing store for ImagePath.  This enables animation, styling, binding, etc...
public static readonly DependencyProperty ImagePathProperty =
    DependencyProperty.Register("ImagePath", typeof(ImageSource),
    typeof(TaskButton), new UIPropertyMetadata(default(ImageSource)));

任何人都可以建议在这个对象的参数中写一些新的UIPropertyMetadata(_argument)

0 个答案:

没有答案