Uno: XAML Intellisense for inner elements

Created on 22 Aug 2019  ·  15Comments  ·  Source: unoplatform/uno

Current behavior

  1. Install https://marketplace.visualstudio.com/items?itemName=nventivecorp.uno-platform-addin
  2. Create a new project using the Cross-Platform App (Uno Platform) app project template
  3. Close the project (see https://developercommunity.visualstudio.com/content/problem/587976/xaml-intellisense-does-not-start-properly-on-proje.html)
  4. Open the MainPage.xaml file in the MyApp.SharedMainPage.xaml
  5. In the project selector, select “MyProject.Droid”
  6. Notice that the Page element is properly recognized by the editor, but the inner elements are not with the message The type Page does not support direct content, even if the type Page has ContentPropertyAttribute defined in its base classes.

Anything else we need to know?

Feedback from https://developercommunity.visualstudio.com/content/problem/587980/xaml-intellisense-does-not-use-contentpropertyattr.html and a recent video call with the Visual Studio team recommended that we look at the Xamarin.Forms project. Specifically ContentPropertyAttributes need to be moved out of Uno.UI.dll and into a design assembly. ie.

image

https://github.com/xamarin/Xamarin.Forms/tree/master/Xamarin.Forms.Core.Design

For which Platform:

  • [x] iOS
  • [x] Android
  • [x] WebAssembly
  • [x] Visual Studio for Windows
  • [ ] Windows
arevswin kinenhancement platforandroid platforios platforwasm projeccore-tools

Most helpful comment

@MatFillion thank you, that worked!

All 15 comments

Moving the attribute out seems like an extremely bad idea, on many levels. Also, that's not what Xamarin.Forms is doing, as the ContentPropertyAttribute is defined in Xamarin.Forms.Core, not in the design assembly.

Maybe the VS designer is looking for the design assembly and looks for the attribute there. We can try creating such an assembly and add references to Uno.UI.dll and see where that leads.

I investigated this a bit more, and it seems that the Design assembly is not loaded/found/parsed by VS. I updated the original issue on community with some additional questions.

Any updates on this? I was trying Uno for the first time just now and this still happens in VS 2019 V16.5.2 and for the version 2.0.532.6 of the templates. Are there any workarounds?

None at this point, we're still looking at this with Microsoft.

Is there ANY workaround to this? Any way we can develop using Uno without this issue?

@LeonardoEstrela-Dev if you set the platform picker to UWP the full intelliscence will work. This issue only occurs if the dropdown is set to something other than UWP, which should rarely be necessary.

@MatFillion thank you, that worked!

@MatFillion Could you elaborate which platform picker you are refering to? Having the UWP Project as Startup Project automatically selects UWP as platform. But still the issue persists if i open the XAML file from the Shared Project:

image

As this is a first impression people are getting when trying out the Uno Platform i think it's this should be priorized higher in order to support adoption.

@marxxxx the picker in question is the one immediately on top of the editor section in your screenshot, which has "UnoApp2.Android". Use the UWP project there.

@jeromelaban Got it, thank you! Did not even know this guy exists! :) That fixes the problem.

Hi what to change to make this error go away in xaml pls ?
image

@michalss please see above, or https://stackoverflow.com/questions/61620422/the-type-page-does-not-support-direct-content

Stack Overflow
I create new Uno Cross-Platform App 2.2 from template. When I open Shared->MainPage.xaml in doesn't open designer in code view there is a underlined error The type 'page' does not support direct co...

@michalss please see above, or https://stackoverflow.com/questions/61620422/the-type-page-does-not-support-direct-content

Stack OverflowThe type 'page' does not support direct contentI create new Uno Cross-Platform App 2.2 from template.
When I open Shared->MainPage.xaml in doesn't open designer in code view there is a underlined error The type 'page' does not support direct co...

Thx it worked, i had to kill editor and start it again. I hope this will be fixed soon.. :)

I followed the stack overflow and the comment threads for this issue and still cant resolve the error.

I was able to resolve it. I had to clean then relaunch the project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MelbourneDeveloper picture MelbourneDeveloper  ·  3Comments

MartinZikmund picture MartinZikmund  ·  3Comments

MartinZikmund picture MartinZikmund  ·  3Comments

PylotLight picture PylotLight  ·  3Comments

Ali-YousefiTelori picture Ali-YousefiTelori  ·  4Comments