Can't you just specify the default property of the dependency property:
public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register(
"Items",
typeof(ObservableCollection
or am I missing what you are after?
Edit:
ah... in that case how about checking for null on the getter?:
public ObservableCollection Items
{
get
{
if ((ObservableCollection)GetValue(ItemsProperty) == null)
{
this.SetValue(ItemsProperty, new ObservableCollection());
}
return (ObservableCollection)GetValue(ItemsProperty);
}
set
{
this.SetValue(ItemsProperty, value);
}
}