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

Make ViewModelLocator Opt-Out #2171

Merged
merged 2 commits into from
Aug 21, 2020
Merged

Make ViewModelLocator Opt-Out #2171

merged 2 commits into from
Aug 21, 2020

Conversation

dansiegel
Copy link
Member

Description of Change

Updates Prism.Wpf & Prism.Uno to make the ViewModelLocator.AutowireViewModel property Opt-Out. This will now automatically set the value to true when creating the Shell, region content, or dialogs

Bugs Fixed

API Changes

Changed:

  • bool ViewModelLocator.AutowireViewModel => bool? ViewModelLocator.AutowireViewModel

Behavioral Changes

Will now automatically set the ViewModelLocator.AutowireViewModel property to true if it has not been set. This WILL be most impactful for those who are injecting their ViewModel's into the ctor of their View. They will now have to either opt-out or remove the ctor injection. Failure to do so will result in the ViewModel being created multiple times.

This does NOT impact Views that are manually created and added to the Region.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard

@brianlagunas brianlagunas merged commit 522799b into master Aug 21, 2020
@brianlagunas brianlagunas deleted the vml-opt-out branch August 21, 2020 21:13
@dansiegel dansiegel added this to the Prism 8.0 milestone Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Make the ViewModelLocator Opt-Out
2 participants