x:DataType doesn't exist

cmeerencmeeren USMember ✭✭

In the recent Xamarin blog post DataBinding Power Moves You May Not Be Using (Yet), David Ortinau uses x:DataType for compiled bindings. Unfortunately, x:DataType doesn't seem to exist for me. Here's an almost verbatim copy of the code in the post:

I am using Xamarin.Forms 2.4.0.282. Am I doing something wrong?

Tagged:

Best Answer

  • cmeerencmeeren USMember ✭✭
    Accepted Answer

    @akamud was right - this was indeed a case of bad tooling. Though DataType is glowing red in the editor, it compiles fine.

Answers

  • akamudakamud BRUniversity ✭✭

    I have tried a similar code with success. My x namespace is the same as yours.
    Did you declare the models namespace too?

  • cmeerencmeeren USMember ✭✭

    @akamud said:
    Did you declare the models namespace too?

    Nope, but AFAIK that shouldn't matter - the error is in the attribute itself, not its declaration.

    Could you please share a minimal working example?

  • akamudakamud BRUniversity ✭✭

    @cmeeren said:

    @akamud said:
    Did you declare the models namespace too?

    Nope, but AFAIK that shouldn't matter - the error is in the attribute itself, not its declaration.

    Could you please share a minimal working example?

    Actually it does matter. You are using a namespace that the XAML does not recognize because you didn't declare it.

    I understand that is not what the error is telling you, but this could be a bad error message or bad tooling support.
    I would try to fix this before investigating any further. After all, you'll have to declare the models namespace later.

    My example has nothing different from yours, except that I declared all the namespaces I'm using.

  • cmeerencmeeren USMember ✭✭

    See here, now everything is defined:

    It's not in the autocomplete list either:

  • cmeerencmeeren USMember ✭✭
    Accepted Answer

    @akamud was right - this was indeed a case of bad tooling. Though DataType is glowing red in the editor, it compiles fine.

Sign In or Register to comment.