Suggesting public properties used in WPF binding can be made private in error.
ReSharper is suggesting my ViewModel public properties I use in binding can be made private in error.
This happens with properties used by Views that do not have a known DataContext at design time.
If I follow the advice from ReSharper and make my properties private the binding fails at runtime.
How can i let resharper know that the particular property is being used in Binding and it cannot be made private ?
Please sign in to leave a comment.
If you can set a design-time data context, that should resolve it:
Otherwise, you'll probably need to decorate your properties with the [UsedImplicitly] attribute; or decorate the view-model with [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)].
https://www.jetbrains.com/help/resharper/Reference__Code_Annotation_Attributes.html