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

Add support for setter protection level for ObservableProperty #758

Closed
sensslen opened this issue Sep 11, 2023 · 1 comment
Closed

Add support for setter protection level for ObservableProperty #758

sensslen opened this issue Sep 11, 2023 · 1 comment
Labels
duplicate 👥 Indicates that an identical issue or PR already exists feature request 📬 A request for new changes to improve functionality mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Comments

@sensslen
Copy link

Overview

When using the [ObservableProperty] attribute to generate the code for the observable property, the protection level of the generated setter is always public

API breakdown

public enum SetterProtection
{
    Public,
    Protected,
    Private
}


[ObservableProperty(SetterProtection = SetterProtection.Private)]
private int _someValue;

Usage example

[ObservableProperty(SetterProtection = SetterProtection.Private)]
private int _someValue;

Breaking change?

No

Alternatives

I am not aware of any

Additional context

I do quite often want to provide readonly properties for binding in xaml. These properties should not be set from xaml. While I can make sure this is how things are done, I don't get any support from the Toolkit (and if the xaml is wrong and sets such a property, It will silently work instead of causing a binding error).

Help us help you

Yes, but only if others can assist

@sensslen sensslen added the feature request 📬 A request for new changes to improve functionality label Sep 11, 2023
@Sergio0694 Sergio0694 added duplicate 👥 Indicates that an identical issue or PR already exists mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit labels Sep 11, 2023
@Sergio0694
Copy link
Member

Duplicate of #291.
Superseded by #555.

@Sergio0694 Sergio0694 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate 👥 Indicates that an identical issue or PR already exists feature request 📬 A request for new changes to improve functionality mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit
Projects
None yet
Development

No branches or pull requests

2 participants