I made a simple INPC property like so:
[ObservableProperty]
private bool _IsReadOnly;
As expected, I can now bind to IsReadOnly in XAML. Great! However, VS now shows me a warning:
Severity Code Description Project File Line Category Suppression State
Warning CS0169 The field 'MyViewModel._IsReadOnly' is never used MyProject MyViewModel.cs 148 Build Active
Makes sense; it doesn't understand that the field exists only for the generated code. However:
- is that the expected behavior?
- even if I wrap the field in
#warning pragma disable CS0169, the warning doesn't go away. Am I missing something?
I made a simple INPC property like so:
As expected, I can now bind to
IsReadOnlyin XAML. Great! However, VS now shows me a warning:Makes sense; it doesn't understand that the field exists only for the generated code. However:
#warning pragma disable CS0169, the warning doesn't go away. Am I missing something?