WinUI 3(C++/WinRT): "NavViewCompactModeThresholdWidth" not found

XiaoLi8848 1 Reputation point
2021-08-25T13:42:38.613+00:00

According to the sample code of the the document in Microsoft Learn, I wrote almost the same code, but it cannot be compiled. There is an error, "NavViewCompactModeThresholdWidth": is not a member of "winrt::ProjectName::implementation::MainWindow" (compiled source file App.xaml.cpp), it seems that the definition of this member should be located in MainWindow.idl, but I have followed The members of this Double type are defined as written in the document, so how can I eliminate this error?
MainWindow.idl
ProjectName.h

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
735 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,454 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,571 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 11,661 Reputation points Microsoft Vendor
    2021-08-26T03:18:02.72+00:00

    According to the linked document, your MainWindow header and source file should have a function named NavViewCompactModeThresholdWidth.

    0 comments No comments