这是我的代码:
public class CustomWidget
{
public System.Drawing.Color Value
{
get { return (System.Drawing.Color)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(System.Drawing.Color), typeof(Color), new UIPropertyMetadata(0));
public System.Drawing.Font Valuee
{
get { return (System.Drawing.Font)GetValue(ValueeProperty); }
set { SetValue(ValueeProperty, value); }
}
public static readonly DependencyProperty ValueeProperty =
DependencyProperty.Register("Valuee", typeof(System.Drawing.Font), typeof(Font), new UIPropertyMetadata(0));
}
对于Font,我可以设置一个默认的Font,我认为没有其他方式,但是Bitmap呢?我绝对必须在我的项目中获得一个将被引用为默认值的位图吗?
答案 0 :(得分:3)
不,您只需使用null
。