Skip to content

CollectionBinding to unassigned property #37

@TimGameDev

Description

@TimGameDev

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...

CollectionBinding.cs

line 141

            var viewModelValue = viewModelCollectionProperty.GetValue(viewModel, null);
            if (viewModelValue == null)
            {
                throw new PropertyNullException(
                    "Cannot bind to null property in view: " 
                    + ViewModelPropertyName
                );
            }

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions