ReSharper warnings with MVVM ReSharper warnings with MVVM wpf wpf

ReSharper warnings with MVVM


You can use External Annotations to indicate to ReSharper the method is used and thus not to warn you. See the ReSharper docs on that here.

You need to decorate any such methods with [UsedImplicitlyAttribute].

Before using the attribute, you see:

enter image description here

and then, after applying the attribute:

[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]class NotUsed{    public int Field1 { get; set; }    public int Field2 { get; set; }}


Use

<UserControl...xmlns:vm="clr-namespace:YourProject.ViewModels" mc:Ignorable="d"d:DataContext="{d:DesignInstance vm:SomeClassViewModel}">

It 'stick's View to Model.In View you could see model properties and vice versa - in model properties should be used.


You can try two different options.

  • Option 1: Reduce the severity of the ReSharper inspection to "Hint".

  • Option 2: Use the "Suppress inspection with comment" item ReSharper provides for the properties that generate the warning that you know are being used.

Personally, I'd go with reducing the severity to "Hint".