CollectionBinding to unassigned property
TimGameDev opened this issue · 0 comments
TimGameDev commented
Hey again,
I have a viewmodel with observable list property. This property watches Model property. initial value of both is null and assigned later. Which is perfectly normal behavior in WPF for example.
But UnityWeld does't allow null for observable list. And I wonder why?
I see in code that CollectionBinding watches this property and rebind if necessary.
And it looks like redundant limitation.
Do I miss something? Can we just silently wait for value instead of exception?
I can implement that, but I realized that I did my previous PR in master, and all my work will go to that PR :) but you can cherry-pick this change...or may be you have an better idea...
line 141
var viewModelValue = viewModelCollectionProperty.GetValue(viewModel, null);
if (viewModelValue == null)
{
throw new PropertyNullException(
"Cannot bind to null property in view: "
+ ViewModelPropertyName
);
}
Thanks.