Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionBinding to unassigned property #37

Open
TimGameDev opened this issue Sep 26, 2019 · 0 comments
Open

CollectionBinding to unassigned property #37

TimGameDev opened this issue Sep 26, 2019 · 0 comments

Comments

@TimGameDev
Copy link

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.

@TimGameDev TimGameDev changed the title CollectionBinding to unsigned property CollectionBinding to unassigned property Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant