Code Analysis Issue

I'm encountering a minor issue: Code analysis is telling me that several properties and methods can be made private, presumably because it is not detecting that these are referenced in XAML through data or command bindings. Would be nice to get this corrected.

2 comments

Hello,

I'm encountering a minor issue: Code analysis is telling me that
several properties and methods can be made private, presumably because
it is not detecting that these are referenced in XAML through data or
command bindings. Would be nice to get this corrected.


It is not possible, even theoretically, to track all 100% of the late-bound
references from XAML. In simple cases, though, ReSharper should be able to
detect the usages. If you think your case is a reasonable one and R# should
be tracking such a usage, then a small solution reproducing the behavior
could help us fix the issue.

If the case is too complicated, you could mark these code members with
and make sure they're not highlighted as redundant.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Understood Serge. Even Visual Studio can't resolve the bindings in the editor. When I try getting a tool tip for the binding I get MS.Internal.Design.Reflection.ReflectionTypeNode.

This is probably due to the fact I'm not setting the DataContext statically.

Using this kind of syntax I'm able to achieve late binding of the data context.

<views:CameraOrientationWizardView />


<!--Wire the view models to the views.-->
<DataTemplate DataType="{x:Type viewModel:CameraOrientationWizardPageViewModelBase}">
    <view:CameraOrientationWizardPageView />
</DataTemplate>


Note the use of a base class, pretty sweet.

Using more straight forward DataContext binding ReSharper was able to recognize the usage and the XAML editor correctly indicates the type in the tooltip.

0

Please sign in to leave a comment.