Incorrect "Dependency property missing" warning in Xaml

Since installing Resharper I've started to notice "Dependency property
missing" errors in my Xaml for attached behaviors.

Here's a simplified repro. Generate a new default WPF application project

=== Add new TestBehavior.cs:

using System.Windows;

namespace WpfApplication7
     public static class TestBehavior
          public static readonly DependencyProperty Foo =
               "Foo", typeof(bool), typeof(TestBehavior));
          public static bool GetFoo(DependencyObject dependencyObject)
               { return (bool)dependencyObject.GetValue(Foo); }
          public static void SetFoo(DependencyObject dependencyObject, bool value)
               { dependencyObject.SetValue(Foo, value); }

=== Edit existing MainWindow.xaml:

The problem occurs in MainWindow.xaml. On my system, the "Foo" in the second
to the last line of MainWindow.xaml is flagged as an error with a squiggly
red line. The tooltip says "Dependency property missing". Yet it exists and
the app builds fine.


Comment actions Permalink

Here's the XML that got filtered out of the newsrc post.

=== Edit existing MainWindow.xaml:

<Window x:Class="WpfApplication7.MainWindow"
     Title="MainWindow" Height="350" Width="525">

     <Grid local:TestBehavior.Foo="true"/>

Comment actions Permalink

WPF conventions imply that dependency properties have the name FooProperty, whereas you declared Foo. That should be the problem here.

Comment actions Permalink

Yes, that was the issue, thank you.


Please sign in to leave a comment.