Attached properties will not show up in xaml

LeloLelo Member ✭✭✭

I am making a autocomplete extension for Entry and SearchBar - and I have looked closely how BindableLayout is created.

Compare AutocompleteExtension with BindableLayout

Basically I wish the attached properties to show up in xaml with intellisense - just like how it does for BindableLayout - so that I can:

I have imported the namespace into xaml like so
xmlns:custom="clr-namespace:Namespace;assembly=AutocompleteExtension"
and I have added a reference of AutocompleteExtensions library project to the forms project.

I don't see any difference in my implementation and that of BindableLayout. So why do I not get Intellisense in xaml with my Autocomplete?

Best Answer

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    @Lelo

    First of all xmlns:custom="clr-namespace:Namespace;assembly=AutocompleteExtension" this namespace have a mistake.

    For example, You can see my PCL name is App51 like following screenshot.

    So, we should change the namespace to xmlns:custom="clr-namespace:App51;assembly=App51"

    Then we used it in the Entry like following format.

      <Entry Placeholder="my"  custom:Autocomplete.ItemsSource=""  ></Entry>
    

    Here is a example about it.
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/behaviors/attached#creating-an-attached-behavior

  • LeloLelo Member ✭✭✭

    Thank you for your reply.
    Here is the project set up:

    AutocompleteExtension is a library. AutocompleteExtensionTest and AutocompleteExtensionTest.iOS are a forms project

    Could you guide me? What should xmlns look like in MainPage.xaml ?

  • LeloLelo Member ✭✭✭

    @LeonLu
    Thanks i'ts working now.

    However, I recently changed the library to a multi targeted library - So it stopped working. I'ts a bit more expected though. But if you or anyone else have any quirks to get it to work - for a multi target library please be so kind and present it!

Sign In or Register to comment.