Question: Why MenuItems does not found on NavigationViewItem #7485
Replies: 10 comments
-
What version of WinUI are you using? It was introduced in very recent version. |
Beta Was this translation helpful? Give feedback.
-
There is no property "contents", try "Content" instead |
Beta Was this translation helpful? Give feedback.
-
@omikhailov is correct, contents is not a property on NavigationViewItem, the name of the property is content. MenuItems was added to NavigationViewItem in Winui 2.4 (or maybe even 2.5...) make sure you have an updated winui2 package. If both of those don't fix it, can you try adding a NavigationViewItem to the MenuItems. Its possible that an empty collection is not supported. |
Beta Was this translation helpful? Give feedback.
-
Sorry I have a wrong typing in issue, it's caused by myself, in my code it is All normal I can re-create my Project/Solution. I'm using Visual Studio 2019 and JB Rider 2021.1. Will VS version cause this error? |
Beta Was this translation helpful? Give feedback.
-
You can try to change namespace to Microsoft.UI.Xaml.Controls. Windows.UI.Xaml.Controls contains platform controls, not WinUI. |
Beta Was this translation helpful? Give feedback.
-
"Cannot resolve namespace |
Beta Was this translation helpful? Give feedback.
-
You will need to add a reference to the Microsoft.UI.Xaml NuGet package and follow the installation steps outlined in the packages readme. |
Beta Was this translation helpful? Give feedback.
-
Thanks, you resolved my problem! If this issue is unimportant, is can be close now, or else it should be open for other developers that has same question |
Beta Was this translation helpful? Give feedback.
-
So the awnser is effectively that you haven't install and aren't actually using WinUI. Or, you are using system UWP which can be also called WinUI 1. |
Beta Was this translation helpful? Give feedback.
-
My fault. A package should be installed. If no further things, this issue can be closed. |
Beta Was this translation helpful? Give feedback.
-
(I am using Visual Studio Chinese translated, the sentence below is translated which may be difference than Oringinal.)
When I typed these code, editor tells me
Unexpected symbol "MenuItems"
Why and what happens?
I even changed my IDE from VS to JB, it's still not working
And also, this is not working
Beta Was this translation helpful? Give feedback.
All reactions