%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXGENERATEPRIENABLED%3E%3C%2FAPPXGENERATEPRIENABLED%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROJECTPRIINDEXNAME%3E%3C%2FPROJECTPRIINDEXNAME%3E%3C%2FSPAN%3EApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXPACKAGE%3E%3C%2FAPPXPACKAGE%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CP%3EFor%20example%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F8.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167369i7D9AEF4203B7BA42%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%228.png%22%20title%3D%228.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMainpage.xml%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3ERemove%3C%2FEM%3E%3C%2FSTRONG%3E.%20And%20then%20click%20%3CSTRONG%3E%3CEM%3EDelete%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECopy%20App.Xaml%2C%20App.cpp%2C%20App.h%2C%20App.idl%20contents%20to%20overwrite%20current%20ones%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb2%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb3%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22pch.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20App%3A%3AApp()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Initialize()%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20AddRef()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22va%22%3Em_inner%3C%2FSPAN%3E.as%26lt%3B%3A%3AIUnknown%26gt%3B()-%26gt%3BRelease()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20App%3A%3A~App()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb4%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%20Declaration%20of%20the%20App%20class.%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.g.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.base.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT2%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20~App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Afactory_implementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.idl%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb5%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20MyApp%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%5Bdefault_interface%5D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20runtimeclass%20App%3A%20Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3ECreate%20app.base.h%20in%20this%20project%2C%20and%20use%20below%20content%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3Eapp.base.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb6%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Estruct%3C%2FSPAN%3E%20App_baseWithProvider%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20App_base%3CD%3E%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20IXamlType%20%3D%20%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AIXamlType%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AInterop%3A%3ATypeName%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20type)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(type)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3Ahstring%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20fullName)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(fullName)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3Awinrt%3A%3Acom_array%26lt%3B%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AXmlnsDefinition%26gt%3B%20GetXmlnsDefinitions()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXmlnsDefinitions()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22dt%22%3Ebool%3C%2FSPAN%3E%20_contentLoaded%7B%20%3CSPAN%20class%3D%22kw%22%3Efalse%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20_appProvider%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20AppProvider()%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(!_appProvider)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_appProvider%20%3D%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Emake_shared%3CXAMLMETADATAPROVIDER%3E()%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20_appProvider%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20AppT2%20%3D%20App_baseWithProvider%3CD%3E%3B%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EInstall%20%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Toolkit.Win32.UI.XamlApplication%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Toolkit.Win32.UI.XamlApplication%3C%2FA%3E%20Nuget%20package.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIf%20you%20build%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20now%2C%20it%20should%20create%20MyApp.dll%20without%20any%20error.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22centralize-output-input-and-cwinrt-files-in-solution%22%20id%3D%22toc-hId--53578826%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId--1413695565%22%20id%3D%22toc-hId--1413695565%22%20id%3D%22toc-hId--1413695565%22%3ECentralize%20Output%2C%20Input%20and%20C%2B%2B%2FWinRT%20files%20in%20Solution%3C%2FH2%3E%0A%3CP%3EThis%20step%20is%20necessary%20for%20our%20next%20steps%20because%20we%20need%20to%20include%20winrt%20header%20files%20in%20different%20projects%20properly%2C%20and%20MFCApp%20also%20needs%20to%20reference%20MyApp%20resource%20files.%3C%2FP%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20a%20new%20Solution.Props%20file%20by%20right%20clicking%20the%20solution%20node%2C%20and%20select%20Add%20-%26gt%3B%20New%20Item%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F13.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167370i9317B7F41B450E97%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2213.png%22%20title%3D%2213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3EUse%20below%20content%20to%20overwrite%20the%20Solution.Props%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb7%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CPROJECT%3E%3C%2FPROJECT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CINTDIR%3E%3C%2FINTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3COUTDIR%3E%3C%2FOUTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CGENERATEDFILESDIR%3E%3C%2FGENERATEDFILESDIR%3E%3C%2FSPAN%3E%24(IntDir)Generated%20Files%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClick%20Views%20-%26gt%3B%20Other%20Windows%20-%26gt%3B%20Property%20Manager%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167371i99C4B3F810979B02%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2214.png%22%20title%3D%2214.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EAdd%20Existing%20Property%20Sheet%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20add%20the%20new%20%3CSTRONG%3E%3CEM%3Esolution.props%3C%2FEM%3E%3C%2FSTRONG%3E%20file%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167372iA5094D41B6ABB36A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2215.png%22%20title%3D%2215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%204.%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%20We%20can%20close%20the%20Property%20Manager%20window%20now.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20project%20node%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Properties.%20Set%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOutput%20Directory%3A%20%24(OutDir)%3C%2FP%3E%0A%3CP%3EIntermidia%20Directory%3A%20%24(IntDir)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167373i654BE14390759307%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2212.png%22%20title%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%227%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%206%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Solution%20node%2C%20and%20choose%20%3CSTRONG%3E%3CEM%3EProject%20Dependencies%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20make%20sure%20MFCApp%20depends%20on%20MyApp%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20373px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167374i0A604407051580F8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2216.png%22%20title%3D%2216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERebuild%20the%20whole%20solution%2C%20it%20should%20work%20without%20errors.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22add-uwp-custom-xaml-control-to-myapp%22%20id%3D%22toc-hId--1861033289%22%20id%3D%22toc-hId--1861033288%22%20id%3D%22toc-hId-1073817268%22%20id%3D%22toc-hId-1073817268%22%20id%3D%22toc-hId-1073817268%22%3EAdd%20UWP%20Custom%20XAML%20Control%20to%20MyApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Add%20-%26gt%3B%20New%20Item%3C%2FLI%3E%0A%3CLI%3ECreate%20%3CSTRONG%3E%3CEM%3EBlank%20User%20Conrol%20(C%2B%2B%2FWinRT)%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20here%20we%20call%20it%20TreeViewUserControl%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167375i1E33193771A456A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.png%22%20title%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22integrate-custom-xaml-control-in-mfcapp%22%20id%3D%22toc-hId-626479544%22%20id%3D%22toc-hId-626479545%22%20id%3D%22toc-hId--733637195%22%20id%3D%22toc-hId--733637195%22%20id%3D%22toc-hId--733637195%22%3EIntegrate%20Custom%20XAML%20Control%20in%20MFCApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20one%20%3CSTRONG%3Eapp.manifest%3C%2FSTRONG%3E%20in%20your%20project%20with%20below%20content%20to%20register%20custom%20control%20type%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb8%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CASSEMBLY%3E%3C%2FASSEMBLY%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v1%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Aasmv3%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v3%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20manifestVersion%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%221.0%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CFILE%3E%3C%2FFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.XamlMetadataProvider%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ENow%20the%20project%20structure%20is%20like%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167376i5303F7EAD8E4D306%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2212.png%22%20title%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Win32%20Project%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EUnload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EEdit%20MFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERemove%20the%20three%20lines%20from%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb9%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20below%20properties%20to%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%20before%20the%20%3CSTRONG%3E%3CEM%3E%E2%80%9C%3CIMPORT%20project%3D%22%E2%80%9D%E2%80%9C%24(VCTargetsPath).Cpp.targets%E2%80%9D%22%3E%3C%2FIMPORT%3E%22%3C%2FEM%3E%3C%2FSTRONG%3E%20line%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb10%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXMANIFEST%3E%3C%2FAPPXMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CAppxManifest.xml%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPPROJECTNAME%3E%3C%2FAPPPROJECTNAME%3E%3C%2FSPAN%3EMyApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPINCLUDEDIRECTORIES%3E%3C%2FAPPINCLUDEDIRECTORIES%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C%3B%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CGenerated%20Files%5C%3B%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.xbf%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5Cresources.pri%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22er%22%3E%26lt%3B%3C%2FSPAN%3E------Right%20Here---------%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CIMPORT%3E%3C%2FIMPORT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Project%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(VCTargetsPath)%5CMicrosoft.Cpp.targets%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%226%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EProperties%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20setup%20%3CSTRONG%3E%3CEM%3E%24(AppIncludeDirectories)%3C%2FEM%3E%3C%2FSTRONG%3E%20as%20a%20part%20of%20include%20file%20path%2C%20this%20macro%20has%20been%20defined%20in%20the%20above%20project%20file%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167377iD516CE1E12CD539C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2217.png%22%20title%3D%2217.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESet%20%3CSTRONG%3E%3CEM%3E%E2%80%9CPer%20Monitor%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20for%20%3CSTRONG%3E%3CEM%3EDPI%20Awareness%3C%2FEM%3E%3C%2FSTRONG%3E%20otherwise%20you%20may%20be%20not%20able%20to%20start%20this%20MFCApp%20when%20it%20is%20%3CSTRONG%3E%3CEM%3E%E2%80%9CHigh%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20and%20hit%20configuration%20error%20in%20Manifest%3A%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167378iA9F1AA239C7E1B2D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2219.png%22%20title%3D%2219.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F19.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%229%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EOpen%20pch.h%2C%20add%20below%20code%20to%20include%20necessary%20winrt%20header%20files%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb11%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20GetCurrentTime%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20TRY%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ERegarding%20the%20reason%20of%20using%20%E2%80%9CGetCurrentTime%E2%80%9D%20and%20%E2%80%9CTRY%E2%80%9D%20macros%2C%20please%20refer%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EUsing%20winrt%20namespaces%20in%20MFCAPPView.h%20and%20MFCAPP.h%3C%2FP%3E%0A%3CDIV%20id%3D%22cb12%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AComposition%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AHosting%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AFoundation%3A%3ANumerics%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AControls%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EDeclare%20hostApp%20in%20%3CSTRONG%3E%3CEM%3EMFCApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb13%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3AApp%20hostApp%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EInitalize%20hostApp%20right%20before%20new%20CMainFrame%20in%20%3CSTRONG%3E%3CEM%3ECMFCAppApp%3A%3AInitInstance()%3C%2FEM%3E%3C%2FSTRONG%3E%20in%20MFCApp.CPP%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb14%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%20%20%20%20hostApp%20%3D%20winrt%3A%3AMyApp%3A%3AApp%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%26lt%3B---Right%20Here---%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22co%22%3E%2F%2F%20create%20main%20MDI%20Frame%20window%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20CMainFrame*%20pMainFrame%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enew%3C%2FSPAN%3E%20CMainFrame%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EDeclare%20_desktopWindowXamlSource%20and%20our%20custom%20control%20in%20MFCAppView.h%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb15%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AHosting%3A%3ADesktopWindowXamlSource%20_desktopWindowXamlSource%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl%20_treeViewUserControl%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2212%22%20type%3D%221%22%3E%0A%3CLI%3EInitialize%20_desktopWindowXamlSource%20and%20custom%20control%20in%20MFCAppView.cpp%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb16%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20%3D%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%20%20%20%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource%20%3D%20DesktopWindowXamlSource%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eauto%3C%2FSPAN%3E%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3BAttachToWindow(GetSafeHwnd()))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20_treeViewUserControl%20%3D%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource.Content(_treeViewUserControl)%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20RECT%20windowRect%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2213%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClean%20up%20resources%20when%20the%20view%20is%20disconstructed%20in%20MFCAppView.cpp%3C%2FP%3E%0A%3CDIV%20id%3D%22cb17%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3ECMFCAppView%3A%3A~CMFCAppView()%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20!%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource.Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EAdd%20AdjustLayout%20function%20to%20make%20XAML%20content%20layout%20properly%20in%20MFCAppView.cpp%20%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AAdjustLayout()%0A%7B%0A%20%20%20%20if%20(_desktopWindowXamlSource%20!%3D%20nullptr)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20auto%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%0A%20%20%20%20%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%0A%20%20%20%20%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%0A%0A%20%20%20%20%20%20%20%20RECT%20windowRect%3B%0A%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%0A%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%200%2C%200%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%0A%20%20%20%20%7D%0A%7D%0A%60%60%60%0A%0ADon't%20forget%20to%20declare%20it%20in%20MFCAppView.h%3A%0A%0A%60%60%60C%2B%2B%0Apublic%3A%0A%20%20%20%20void%20AdjustLayout()%3B%0A%60%60%60%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2215%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20MFCApp%20project%2C%20select%20%3CSTRONG%3EClass%20Wizard%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167379iAC8A42F2A07337D9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%229.png%22%20title%3D%229.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAdd%20a%20handler%20to%20handle%20WM_SIZE%20so%20that%20when%20view%20size%20changes%20we%20can%20handle%20it%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167380i09E5CC2D3B241224%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.png%22%20title%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EModify%20the%20OnSize%20method%20handler%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AOnSize(UINT%20nType%2C%20int%20cx%2C%20int%20cy)%0A%7B%0A%20%20%20%20CView%3A%3AOnSize(nType%2C%20cx%2C%20cy)%3B%0A%20%20%20%20AdjustLayout()%3B%0A%7D%0A%60%60%60%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2217%22%20type%3D%221%22%3E%0A%3CLI%3ENow%20you%20can%20build%20and%20run%20this%20MFCApp.%20It%20should%20display%20a%20button%20in%20the%20central%20of%20view%20window%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F21.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167381iF2614F3937B6530F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2221.gif%22%20title%3D%2221.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22using-winui-in-uwp-custom-control-in-myapp-uwp-project%22%20id%3D%22toc-hId--1180974919%22%20id%3D%22toc-hId--1180974918%22%20id%3D%22toc-hId-1753875638%22%20id%3D%22toc-hId-1753875638%22%20id%3D%22toc-hId-1753875638%22%3EUsing%20WinUI%20in%20UWP%20Custom%20Control%20in%20MyApp%20UWP%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EIn%20MyApp%2C%20let%E2%80%99s%20add%20the%20%3CSTRONG%3E%3CEM%3EMicrosoft.UI.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%20nuget%20package%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F22.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167382iC0BA586A67E97EFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2222.png%22%20title%3D%2222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%5B!NOTE%5D%20It%20is%20possible%20some%20version%20of%20WinUI%20nuget%20package%20doesn%E2%80%99t%20create%20Microsoft.UI.Xaml.Controls%20class%20registering%20info%20into%20AppxManifest.xml%2C%20which%20is%20required%20by%20MFCApp%20later.%20This%20version%20used%20above%20works%20well.%20If%20you%20found%20MFCApp%20failed%20to%20run%20with%20%E2%80%9CClass%20is%20not%20registered%E2%80%9D%20error%2C%20please%20try%20this%20version.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EModify%20App.Xaml%2C%20TreeViewUserControl.Xaml%2C%20pch.h%20and%20TreeViewUserContro.cpp%20as%20below%3A%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EFor%20detailed%20reasons%20on%20modifying%20these%20files%2C%20can%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Fsimple-winui-example%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAdd%20the%20Windows%20UI%20(WinUI)%20Theme%20Resources%20to%20%3CSTRONG%3E%3CEM%3EApp.Xmal%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb20%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AMSMarkup%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Markup%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION.RESOURCES%3E%3C%2FXAMLAPPLICATION.RESOURCES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLCONTROLSRESOURCES%3E%3C%2FXAMLCONTROLSRESOURCES%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20WinUI%20reference%20and%20WinUI%20TreeView%20control%20in%20%3CSTRONG%3E%3CEM%3ETreeViewUserControl.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb21%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CUSERCONTROL%3E%3C%2FUSERCONTROL%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amuxc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CSTACKPANEL%3E%3C%2FSTACKPANEL%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Orientation%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Horizontal%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20HorizontalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20VerticalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CBUTTON%3E%3C%2FBUTTON%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Button%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Click%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22ClickHandler%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3EClick%20Me%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW%3E%3C%2FTREEVIEW%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22WinUITreeView%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW.ROOTNODES%3E%3C%2FTREEVIEW.ROOTNODES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Flavors%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20IsExpanded%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22True%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE.CHILDREN%3E%3C%2FTREEVIEWNODE.CHILDREN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Vanilla%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Strawberry%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Chocolate%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EInclude%20WinUI%20winrt%20header%20files%20in%20%3CSTRONG%3E%3CEM%3Epch.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb22%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.Controls.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.XamlTypeInfo.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ETreeViewUserControl.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb23%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22dt%22%3Evoid%3C%2FSPAN%3E%20TreeViewUserControl%3A%3AClickHandler(IInspectable%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%2C%20RoutedEventArgs%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Button().Content(box_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%20tn%20%3D%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20tn.Content(winrt%3A%3Abox_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20WinUITreeView().RootNodes().First().Current().Children().Append(tn)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3EBuild%20and%20run%20MFCApp%2C%20if%20steps%20have%20been%20taken%20exactly%20as%20above%2C%20it%20will%20show%20as%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F23.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167383iD458144BF092A07C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2223.gif%22%20title%3D%2223.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22wrap-up%22%20id%3D%22toc-hId-1306537914%22%20id%3D%22toc-hId-1306537915%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId--53578825%22%3EWrap%20Up%3C%2FH2%3E%0A%3CP%3EThis%20article%20gives%20detailed%20steps%20on%20how%20to%20leverage%20XamplApplication%20to%20host%20custom%20XAML%20control%20in%20document%20view%20of%20traditional%20MFC%20Mulitple%20Document%20Interface%20project%2C%20and%20the%20important%20thing%20is%20you%20can%20use%20WinUI%20to%20modernize%20the%20MFC%20application%20now.%20The%20whole%20smaple%20solution%20can%20be%20found%20from%20this%20repo%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%3C%2FA%3E%3C%2FP%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXGENERATEPRIENABLED%3E%3C%2FAPPXGENERATEPRIENABLED%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROJECTPRIINDEXNAME%3E%3C%2FPROJECTPRIINDEXNAME%3E%3C%2FSPAN%3EApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXPACKAGE%3E%3C%2FAPPXPACKAGE%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CP%3EFor%20example%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F8.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167369i7D9AEF4203B7BA42%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%228.png%22%20title%3D%228.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMainpage.xml%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3ERemove%3C%2FEM%3E%3C%2FSTRONG%3E.%20And%20then%20click%20%3CSTRONG%3E%3CEM%3EDelete%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECopy%20App.Xaml%2C%20App.cpp%2C%20App.h%2C%20App.idl%20contents%20to%20overwrite%20current%20ones%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb2%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb3%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22pch.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20App%3A%3AApp()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Initialize()%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20AddRef()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22va%22%3Em_inner%3C%2FSPAN%3E.as%26lt%3B%3A%3AIUnknown%26gt%3B()-%26gt%3BRelease()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20App%3A%3A~App()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb4%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%20Declaration%20of%20the%20App%20class.%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.g.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.base.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT2%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20~App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Afactory_implementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.idl%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb5%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20MyApp%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%5Bdefault_interface%5D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20runtimeclass%20App%3A%20Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3ECreate%20app.base.h%20in%20this%20project%2C%20and%20use%20below%20content%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3Eapp.base.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb6%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Estruct%3C%2FSPAN%3E%20App_baseWithProvider%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20App_base%3CD%3E%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20IXamlType%20%3D%20%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AIXamlType%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AInterop%3A%3ATypeName%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20type)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(type)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3Ahstring%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20fullName)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(fullName)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3Awinrt%3A%3Acom_array%26lt%3B%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AXmlnsDefinition%26gt%3B%20GetXmlnsDefinitions()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXmlnsDefinitions()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22dt%22%3Ebool%3C%2FSPAN%3E%20_contentLoaded%7B%20%3CSPAN%20class%3D%22kw%22%3Efalse%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20_appProvider%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20AppProvider()%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(!_appProvider)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_appProvider%20%3D%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Emake_shared%3CXAMLMETADATAPROVIDER%3E()%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20_appProvider%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20AppT2%20%3D%20App_baseWithProvider%3CD%3E%3B%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EInstall%20%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Toolkit.Win32.UI.XamlApplication%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Toolkit.Win32.UI.XamlApplication%3C%2FA%3E%20Nuget%20package.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIf%20you%20build%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20now%2C%20it%20should%20create%20MyApp.dll%20without%20any%20error.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22centralize-output-input-and-cwinrt-files-in-solution%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId--500916548%22%20id%3D%22toc-hId--1861033288%22%20id%3D%22toc-hId--1861033288%22%3ECentralize%20Output%2C%20Input%20and%20C%2B%2B%2FWinRT%20files%20in%20Solution%3C%2FH2%3E%0A%3CP%3EThis%20step%20is%20necessary%20for%20our%20next%20steps%20because%20we%20need%20to%20include%20winrt%20header%20files%20in%20different%20projects%20properly%2C%20and%20MFCApp%20also%20needs%20to%20reference%20MyApp%20resource%20files.%3C%2FP%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20a%20new%20Solution.Props%20file%20by%20right%20clicking%20the%20solution%20node%2C%20and%20select%20Add%20-%26gt%3B%20New%20Item%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F13.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167370i9317B7F41B450E97%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2213.png%22%20title%3D%2213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3EUse%20below%20content%20to%20overwrite%20the%20Solution.Props%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb7%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CPROJECT%3E%3C%2FPROJECT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CINTDIR%3E%3C%2FINTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3COUTDIR%3E%3C%2FOUTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CGENERATEDFILESDIR%3E%3C%2FGENERATEDFILESDIR%3E%3C%2FSPAN%3E%24(IntDir)Generated%20Files%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClick%20Views%20-%26gt%3B%20Other%20Windows%20-%26gt%3B%20Property%20Manager%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167371i99C4B3F810979B02%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2214.png%22%20title%3D%2214.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EAdd%20Existing%20Property%20Sheet%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20add%20the%20new%20%3CSTRONG%3E%3CEM%3Esolution.props%3C%2FEM%3E%3C%2FSTRONG%3E%20file%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167372iA5094D41B6ABB36A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2215.png%22%20title%3D%2215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%204.%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%20We%20can%20close%20the%20Property%20Manager%20window%20now.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20project%20node%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Properties.%20Set%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOutput%20Directory%3A%20%24(OutDir)%3C%2FP%3E%0A%3CP%3EIntermidia%20Directory%3A%20%24(IntDir)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167373i654BE14390759307%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2212.png%22%20title%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%227%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%206%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Solution%20node%2C%20and%20choose%20%3CSTRONG%3E%3CEM%3EProject%20Dependencies%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20make%20sure%20MFCApp%20depends%20on%20MyApp%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20373px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167374i0A604407051580F8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2216.png%22%20title%3D%2216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERebuild%20the%20whole%20solution%2C%20it%20should%20work%20without%20errors.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22add-uwp-custom-xaml-control-to-myapp%22%20id%3D%22toc-hId--1861033288%22%20id%3D%22toc-hId--634601272%22%20id%3D%22toc-hId-626479545%22%20id%3D%22toc-hId-626479545%22%3EAdd%20UWP%20Custom%20XAML%20Control%20to%20MyApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Add%20-%26gt%3B%20New%20Item%3C%2FLI%3E%0A%3CLI%3ECreate%20%3CSTRONG%3E%3CEM%3EBlank%20User%20Conrol%20(C%2B%2B%2FWinRT)%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20here%20we%20call%20it%20TreeViewUserControl%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167375i1E33193771A456A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.png%22%20title%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22integrate-custom-xaml-control-in-mfcapp%22%20id%3D%22toc-hId-626479545%22%20id%3D%22toc-hId-1852911561%22%20id%3D%22toc-hId--1180974918%22%20id%3D%22toc-hId--1180974918%22%3EIntegrate%20Custom%20XAML%20Control%20in%20MFCApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20one%20%3CSTRONG%3Eapp.manifest%3C%2FSTRONG%3E%20in%20your%20project%20with%20below%20content%20to%20register%20custom%20control%20type%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb8%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CASSEMBLY%3E%3C%2FASSEMBLY%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v1%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Aasmv3%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v3%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20manifestVersion%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%221.0%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CFILE%3E%3C%2FFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.XamlMetadataProvider%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ENow%20the%20project%20structure%20is%20like%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167376i5303F7EAD8E4D306%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2212.png%22%20title%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Win32%20Project%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EUnload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EEdit%20MFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERemove%20the%20three%20lines%20from%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb9%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20below%20properties%20to%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%20before%20the%20%3CSTRONG%3E%3CEM%3E%E2%80%9C%3CIMPORT%20project%3D%22%E2%80%9D%E2%80%9C%24(VCTargetsPath).Cpp.targets%E2%80%9D%22%3E%3C%2FIMPORT%3E%22%3C%2FEM%3E%3C%2FSTRONG%3E%20line%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb10%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXMANIFEST%3E%3C%2FAPPXMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CAppxManifest.xml%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPPROJECTNAME%3E%3C%2FAPPPROJECTNAME%3E%3C%2FSPAN%3EMyApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPINCLUDEDIRECTORIES%3E%3C%2FAPPINCLUDEDIRECTORIES%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C%3B%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CGenerated%20Files%5C%3B%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.xbf%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5Cresources.pri%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22er%22%3E%26lt%3B%3C%2FSPAN%3E------Right%20Here---------%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CIMPORT%3E%3C%2FIMPORT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Project%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(VCTargetsPath)%5CMicrosoft.Cpp.targets%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%226%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EProperties%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20setup%20%3CSTRONG%3E%3CEM%3E%24(AppIncludeDirectories)%3C%2FEM%3E%3C%2FSTRONG%3E%20as%20a%20part%20of%20include%20file%20path%2C%20this%20macro%20has%20been%20defined%20in%20the%20above%20project%20file%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167377iD516CE1E12CD539C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2217.png%22%20title%3D%2217.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESet%20%3CSTRONG%3E%3CEM%3E%E2%80%9CPer%20Monitor%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20for%20%3CSTRONG%3E%3CEM%3EDPI%20Awareness%3C%2FEM%3E%3C%2FSTRONG%3E%20otherwise%20you%20may%20be%20not%20able%20to%20start%20this%20MFCApp%20when%20it%20is%20%3CSTRONG%3E%3CEM%3E%E2%80%9CHigh%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20and%20hit%20configuration%20error%20in%20Manifest%3A%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167378iA9F1AA239C7E1B2D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2219.png%22%20title%3D%2219.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F19.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%229%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EOpen%20pch.h%2C%20add%20below%20code%20to%20include%20necessary%20winrt%20header%20files%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb11%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20GetCurrentTime%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20TRY%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ERegarding%20the%20reason%20of%20using%20%E2%80%9CGetCurrentTime%E2%80%9D%20and%20%E2%80%9CTRY%E2%80%9D%20macros%2C%20please%20refer%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EUsing%20winrt%20namespaces%20in%20MFCAPPView.h%20and%20MFCAPP.h%3C%2FP%3E%0A%3CDIV%20id%3D%22cb12%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AComposition%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AHosting%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AFoundation%3A%3ANumerics%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AControls%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EDeclare%20hostApp%20in%20%3CSTRONG%3E%3CEM%3EMFCApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb13%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3AApp%20hostApp%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EInitalize%20hostApp%20right%20before%20new%20CMainFrame%20in%20%3CSTRONG%3E%3CEM%3ECMFCAppApp%3A%3AInitInstance()%3C%2FEM%3E%3C%2FSTRONG%3E%20in%20MFCApp.CPP%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb14%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%20%20%20%20hostApp%20%3D%20winrt%3A%3AMyApp%3A%3AApp%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%26lt%3B---Right%20Here---%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22co%22%3E%2F%2F%20create%20main%20MDI%20Frame%20window%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20CMainFrame*%20pMainFrame%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enew%3C%2FSPAN%3E%20CMainFrame%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EDeclare%20_desktopWindowXamlSource%20and%20our%20custom%20control%20in%20MFCAppView.h%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb15%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AHosting%3A%3ADesktopWindowXamlSource%20_desktopWindowXamlSource%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl%20_treeViewUserControl%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2212%22%20type%3D%221%22%3E%0A%3CLI%3EInitialize%20_desktopWindowXamlSource%20and%20custom%20control%20in%20MFCAppView.cpp%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb16%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20%3D%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%20%20%20%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource%20%3D%20DesktopWindowXamlSource%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eauto%3C%2FSPAN%3E%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3BAttachToWindow(GetSafeHwnd()))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20_treeViewUserControl%20%3D%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource.Content(_treeViewUserControl)%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20RECT%20windowRect%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2213%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClean%20up%20resources%20when%20the%20view%20is%20disconstructed%20in%20MFCAppView.cpp%3C%2FP%3E%0A%3CDIV%20id%3D%22cb17%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3ECMFCAppView%3A%3A~CMFCAppView()%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20!%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource.Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EAdd%20AdjustLayout%20function%20to%20make%20XAML%20content%20layout%20properly%20in%20MFCAppView.cpp%20%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AAdjustLayout()%0A%7B%0A%20%20%20%20if%20(_desktopWindowXamlSource%20!%3D%20nullptr)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20auto%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%0A%20%20%20%20%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%0A%20%20%20%20%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%0A%0A%20%20%20%20%20%20%20%20RECT%20windowRect%3B%0A%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%0A%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%200%2C%200%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%0A%20%20%20%20%7D%0A%7D%0A%60%60%60%0A%0ADon't%20forget%20to%20declare%20it%20in%20MFCAppView.h%3A%0A%0A%60%60%60C%2B%2B%0Apublic%3A%0A%20%20%20%20void%20AdjustLayout()%3B%0A%60%60%60%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2215%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20MFCApp%20project%2C%20select%20%3CSTRONG%3EClass%20Wizard%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167379iAC8A42F2A07337D9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%229.png%22%20title%3D%229.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAdd%20a%20handler%20to%20handle%20WM_SIZE%20so%20that%20when%20view%20size%20changes%20we%20can%20handle%20it%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167380i09E5CC2D3B241224%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.png%22%20title%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EModify%20the%20OnSize%20method%20handler%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AOnSize(UINT%20nType%2C%20int%20cx%2C%20int%20cy)%0A%7B%0A%20%20%20%20CView%3A%3AOnSize(nType%2C%20cx%2C%20cy)%3B%0A%20%20%20%20AdjustLayout()%3B%0A%7D%0A%60%60%60%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2217%22%20type%3D%221%22%3E%0A%3CLI%3ENow%20you%20can%20build%20and%20run%20this%20MFCApp.%20It%20should%20display%20a%20button%20in%20the%20central%20of%20view%20window%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F21.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167381iF2614F3937B6530F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2221.gif%22%20title%3D%2221.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22using-winui-in-uwp-custom-control-in-myapp-uwp-project%22%20id%3D%22toc-hId--1180974918%22%20id%3D%22toc-hId-45457098%22%20id%3D%22toc-hId-1306537915%22%20id%3D%22toc-hId-1306537915%22%3EUsing%20WinUI%20in%20UWP%20Custom%20Control%20in%20MyApp%20UWP%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EIn%20MyApp%2C%20let%E2%80%99s%20add%20the%20%3CSTRONG%3E%3CEM%3EMicrosoft.UI.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%20nuget%20package%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F22.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167382iC0BA586A67E97EFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2222.png%22%20title%3D%2222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%5B!NOTE%5D%20It%20is%20possible%20some%20version%20of%20WinUI%20nuget%20package%20doesn%E2%80%99t%20create%20Microsoft.UI.Xaml.Controls%20class%20registering%20info%20into%20AppxManifest.xml%2C%20which%20is%20required%20by%20MFCApp%20later.%20This%20version%20used%20above%20works%20well.%20If%20you%20found%20MFCApp%20failed%20to%20run%20with%20%E2%80%9CClass%20is%20not%20registered%E2%80%9D%20error%2C%20please%20try%20this%20version.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EModify%20App.Xaml%2C%20TreeViewUserControl.Xaml%2C%20pch.h%20and%20TreeViewUserContro.cpp%20as%20below%3A%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EFor%20detailed%20reasons%20on%20modifying%20these%20files%2C%20can%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Fsimple-winui-example%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAdd%20the%20Windows%20UI%20(WinUI)%20Theme%20Resources%20to%20%3CSTRONG%3E%3CEM%3EApp.Xmal%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb20%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AMSMarkup%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Markup%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION.RESOURCES%3E%3C%2FXAMLAPPLICATION.RESOURCES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLCONTROLSRESOURCES%3E%3C%2FXAMLCONTROLSRESOURCES%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20WinUI%20reference%20and%20WinUI%20TreeView%20control%20in%20%3CSTRONG%3E%3CEM%3ETreeViewUserControl.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb21%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CUSERCONTROL%3E%3C%2FUSERCONTROL%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amuxc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CSTACKPANEL%3E%3C%2FSTACKPANEL%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Orientation%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Horizontal%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20HorizontalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20VerticalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CBUTTON%3E%3C%2FBUTTON%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Button%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Click%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22ClickHandler%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3EClick%20Me%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW%3E%3C%2FTREEVIEW%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22WinUITreeView%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW.ROOTNODES%3E%3C%2FTREEVIEW.ROOTNODES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Flavors%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20IsExpanded%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22True%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE.CHILDREN%3E%3C%2FTREEVIEWNODE.CHILDREN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Vanilla%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Strawberry%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Chocolate%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EInclude%20WinUI%20winrt%20header%20files%20in%20%3CSTRONG%3E%3CEM%3Epch.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb22%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.Controls.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.XamlTypeInfo.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ETreeViewUserControl.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb23%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22dt%22%3Evoid%3C%2FSPAN%3E%20TreeViewUserControl%3A%3AClickHandler(IInspectable%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%2C%20RoutedEventArgs%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Button().Content(box_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%20tn%20%3D%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20tn.Content(winrt%3A%3Abox_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20WinUITreeView().RootNodes().First().Current().Children().Append(tn)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3EBuild%20and%20run%20MFCApp%2C%20if%20steps%20have%20been%20taken%20exactly%20as%20above%2C%20it%20will%20show%20as%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F23.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167383iD458144BF092A07C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2223.gif%22%20title%3D%2223.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22wrap-up%22%20id%3D%22toc-hId-1306537915%22%20id%3D%22toc-hId--1761997365%22%20id%3D%22toc-hId--500916548%22%20id%3D%22toc-hId--500916548%22%3EWrap%20Up%3C%2FH2%3E%0A%3CP%3EThis%20article%20gives%20detailed%20steps%20on%20how%20to%20leverage%20XamplApplication%20to%20host%20custom%20XAML%20control%20in%20document%20view%20of%20traditional%20MFC%20Mulitple%20Document%20Interface%20project%2C%20and%20the%20important%20thing%20is%20you%20can%20use%20WinUI%20to%20modernize%20the%20MFC%20application%20now.%20The%20whole%20smaple%20solution%20can%20be%20found%20from%20this%20repo%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%3C%2FA%3E%3C%2FP%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXGENERATEPRIENABLED%3E%3C%2FAPPXGENERATEPRIENABLED%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROJECTPRIINDEXNAME%3E%3C%2FPROJECTPRIINDEXNAME%3E%3C%2FSPAN%3EApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXPACKAGE%3E%3C%2FAPPXPACKAGE%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CP%3EFor%20example%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F8.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%228.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167369i7D9AEF4203B7BA42%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%228.png%22%20alt%3D%228.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMainpage.xml%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3ERemove%3C%2FEM%3E%3C%2FSTRONG%3E.%20And%20then%20click%20%3CSTRONG%3E%3CEM%3EDelete%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECopy%20App.Xaml%2C%20App.cpp%2C%20App.h%2C%20App.idl%20contents%20to%20overwrite%20current%20ones%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb2%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb3%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22pch.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20App%3A%3AApp()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Initialize()%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20AddRef()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22va%22%3Em_inner%3C%2FSPAN%3E.as%26lt%3B%3A%3AIUnknown%26gt%3B()-%26gt%3BRelease()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20App%3A%3A~App()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb4%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%20Declaration%20of%20the%20App%20class.%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.g.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.base.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT2%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20~App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Afactory_implementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.idl%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb5%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20MyApp%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%5Bdefault_interface%5D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20runtimeclass%20App%3A%20Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3ECreate%20app.base.h%20in%20this%20project%2C%20and%20use%20below%20content%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3Eapp.base.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb6%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Estruct%3C%2FSPAN%3E%20App_baseWithProvider%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20App_base%3CD%3E%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20IXamlType%20%3D%20%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AIXamlType%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AInterop%3A%3ATypeName%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20type)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(type)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3Ahstring%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20fullName)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(fullName)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3Awinrt%3A%3Acom_array%26lt%3B%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AXmlnsDefinition%26gt%3B%20GetXmlnsDefinitions()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXmlnsDefinitions()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22dt%22%3Ebool%3C%2FSPAN%3E%20_contentLoaded%7B%20%3CSPAN%20class%3D%22kw%22%3Efalse%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20_appProvider%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20AppProvider()%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(!_appProvider)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_appProvider%20%3D%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Emake_shared%3CXAMLMETADATAPROVIDER%3E()%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20_appProvider%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20AppT2%20%3D%20App_baseWithProvider%3CD%3E%3B%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EInstall%20%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Toolkit.Win32.UI.XamlApplication%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Toolkit.Win32.UI.XamlApplication%3C%2FA%3E%20Nuget%20package.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIf%20you%20build%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20now%2C%20it%20should%20create%20MyApp.dll%20without%20any%20error.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22centralize-output-input-and-cwinrt-files-in-solution%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId-725515468%22%20id%3D%22toc-hId--634601272%22%3ECentralize%20Output%2C%20Input%20and%20C%2B%2B%2FWinRT%20files%20in%20Solution%3C%2FH2%3E%0A%3CP%3EThis%20step%20is%20necessary%20for%20our%20next%20steps%20because%20we%20need%20to%20include%20winrt%20header%20files%20in%20different%20projects%20properly%2C%20and%20MFCApp%20also%20needs%20to%20reference%20MyApp%20resource%20files.%3C%2FP%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20a%20new%20Solution.Props%20file%20by%20right%20clicking%20the%20solution%20node%2C%20and%20select%20Add%20-%26gt%3B%20New%20Item%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F13.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2213.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167370i9317B7F41B450E97%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2213.png%22%20alt%3D%2213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3EUse%20below%20content%20to%20overwrite%20the%20Solution.Props%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb7%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CPROJECT%3E%3C%2FPROJECT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CINTDIR%3E%3C%2FINTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3COUTDIR%3E%3C%2FOUTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CGENERATEDFILESDIR%3E%3C%2FGENERATEDFILESDIR%3E%3C%2FSPAN%3E%24(IntDir)Generated%20Files%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClick%20Views%20-%26gt%3B%20Other%20Windows%20-%26gt%3B%20Property%20Manager%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2214.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167371i99C4B3F810979B02%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2214.png%22%20alt%3D%2214.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EAdd%20Existing%20Property%20Sheet%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20add%20the%20new%20%3CSTRONG%3E%3CEM%3Esolution.props%3C%2FEM%3E%3C%2FSTRONG%3E%20file%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2215.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167372iA5094D41B6ABB36A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2215.png%22%20alt%3D%2215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%204.%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%20We%20can%20close%20the%20Property%20Manager%20window%20now.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20project%20node%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Properties.%20Set%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOutput%20Directory%3A%20%24(OutDir)%3C%2FP%3E%0A%3CP%3EIntermidia%20Directory%3A%20%24(IntDir)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167373i654BE14390759307%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2212.png%22%20alt%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%227%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%206%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Solution%20node%2C%20and%20choose%20%3CSTRONG%3E%3CEM%3EProject%20Dependencies%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20make%20sure%20MFCApp%20depends%20on%20MyApp%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2216.png%22%20style%3D%22width%3A%20373px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167374i0A604407051580F8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2216.png%22%20alt%3D%2216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERebuild%20the%20whole%20solution%2C%20it%20should%20work%20without%20errors.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22add-uwp-custom-xaml-control-to-myapp%22%20id%3D%22toc-hId--1861033288%22%20id%3D%22toc-hId--1081938995%22%20id%3D%22toc-hId-1852911561%22%3EAdd%20UWP%20Custom%20XAML%20Control%20to%20MyApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Add%20-%26gt%3B%20New%20Item%3C%2FLI%3E%0A%3CLI%3ECreate%20%3CSTRONG%3E%3CEM%3EBlank%20User%20Conrol%20(C%2B%2B%2FWinRT)%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20here%20we%20call%20it%20TreeViewUserControl%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2210.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167375i1E33193771A456A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2210.png%22%20alt%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22integrate-custom-xaml-control-in-mfcapp%22%20id%3D%22toc-hId-626479545%22%20id%3D%22toc-hId-1405573838%22%20id%3D%22toc-hId-45457098%22%3EIntegrate%20Custom%20XAML%20Control%20in%20MFCApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20one%20%3CSTRONG%3Eapp.manifest%3C%2FSTRONG%3E%20in%20your%20project%20with%20below%20content%20to%20register%20custom%20control%20type%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb8%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CASSEMBLY%3E%3C%2FASSEMBLY%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v1%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Aasmv3%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v3%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20manifestVersion%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%221.0%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CFILE%3E%3C%2FFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.XamlMetadataProvider%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ENow%20the%20project%20structure%20is%20like%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167376i5303F7EAD8E4D306%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2212.png%22%20alt%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Win32%20Project%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EUnload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EEdit%20MFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERemove%20the%20three%20lines%20from%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb9%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20below%20properties%20to%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%20before%20the%20%3CSTRONG%3E%3CEM%3E%E2%80%9C%3CIMPORT%20project%3D%22%E2%80%9D%E2%80%9C%24(VCTargetsPath).Cpp.targets%E2%80%9D%22%3E%3C%2FIMPORT%3E%22%3C%2FEM%3E%3C%2FSTRONG%3E%20line%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb10%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXMANIFEST%3E%3C%2FAPPXMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CAppxManifest.xml%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPPROJECTNAME%3E%3C%2FAPPPROJECTNAME%3E%3C%2FSPAN%3EMyApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPINCLUDEDIRECTORIES%3E%3C%2FAPPINCLUDEDIRECTORIES%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C%3B%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CGenerated%20Files%5C%3B%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.xbf%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5Cresources.pri%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22er%22%3E%26lt%3B%3C%2FSPAN%3E------Right%20Here---------%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CIMPORT%3E%3C%2FIMPORT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Project%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(VCTargetsPath)%5CMicrosoft.Cpp.targets%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%226%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EProperties%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20setup%20%3CSTRONG%3E%3CEM%3E%24(AppIncludeDirectories)%3C%2FEM%3E%3C%2FSTRONG%3E%20as%20a%20part%20of%20include%20file%20path%2C%20this%20macro%20has%20been%20defined%20in%20the%20above%20project%20file%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2217.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167377iD516CE1E12CD539C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2217.png%22%20alt%3D%2217.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESet%20%3CSTRONG%3E%3CEM%3E%E2%80%9CPer%20Monitor%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20for%20%3CSTRONG%3E%3CEM%3EDPI%20Awareness%3C%2FEM%3E%3C%2FSTRONG%3E%20otherwise%20you%20may%20be%20not%20able%20to%20start%20this%20MFCApp%20when%20it%20is%20%3CSTRONG%3E%3CEM%3E%E2%80%9CHigh%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20and%20hit%20configuration%20error%20in%20Manifest%3A%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2219.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167378iA9F1AA239C7E1B2D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2219.png%22%20alt%3D%2219.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F19.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%229%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EOpen%20pch.h%2C%20add%20below%20code%20to%20include%20necessary%20winrt%20header%20files%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb11%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20GetCurrentTime%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20TRY%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ERegarding%20the%20reason%20of%20using%20%E2%80%9CGetCurrentTime%E2%80%9D%20and%20%E2%80%9CTRY%E2%80%9D%20macros%2C%20please%20refer%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EUsing%20winrt%20namespaces%20in%20MFCAPPView.h%20and%20MFCAPP.h%3C%2FP%3E%0A%3CDIV%20id%3D%22cb12%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AComposition%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AHosting%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AFoundation%3A%3ANumerics%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AControls%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EDeclare%20hostApp%20in%20%3CSTRONG%3E%3CEM%3EMFCApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb13%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3AApp%20hostApp%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EInitalize%20hostApp%20right%20before%20new%20CMainFrame%20in%20%3CSTRONG%3E%3CEM%3ECMFCAppApp%3A%3AInitInstance()%3C%2FEM%3E%3C%2FSTRONG%3E%20in%20MFCApp.CPP%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb14%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%20%20%20%20hostApp%20%3D%20winrt%3A%3AMyApp%3A%3AApp%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%26lt%3B---Right%20Here---%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22co%22%3E%2F%2F%20create%20main%20MDI%20Frame%20window%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20CMainFrame*%20pMainFrame%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enew%3C%2FSPAN%3E%20CMainFrame%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EDeclare%20_desktopWindowXamlSource%20and%20our%20custom%20control%20in%20MFCAppView.h%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb15%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AHosting%3A%3ADesktopWindowXamlSource%20_desktopWindowXamlSource%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl%20_treeViewUserControl%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2212%22%20type%3D%221%22%3E%0A%3CLI%3EInitialize%20_desktopWindowXamlSource%20and%20custom%20control%20in%20MFCAppView.cpp%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb16%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20%3D%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%20%20%20%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource%20%3D%20DesktopWindowXamlSource%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eauto%3C%2FSPAN%3E%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3BAttachToWindow(GetSafeHwnd()))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20_treeViewUserControl%20%3D%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource.Content(_treeViewUserControl)%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20RECT%20windowRect%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2213%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClean%20up%20resources%20when%20the%20view%20is%20disconstructed%20in%20MFCAppView.cpp%3C%2FP%3E%0A%3CDIV%20id%3D%22cb17%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3ECMFCAppView%3A%3A~CMFCAppView()%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20!%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource.Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EAdd%20AdjustLayout%20function%20to%20make%20XAML%20content%20layout%20properly%20in%20MFCAppView.cpp%20%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AAdjustLayout()%0A%7B%0A%20%20%20%20if%20(_desktopWindowXamlSource%20!%3D%20nullptr)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20auto%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%0A%20%20%20%20%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%0A%20%20%20%20%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%0A%0A%20%20%20%20%20%20%20%20RECT%20windowRect%3B%0A%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%0A%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%200%2C%200%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%0A%20%20%20%20%7D%0A%7D%0A%60%60%60%0A%0ADon't%20forget%20to%20declare%20it%20in%20MFCAppView.h%3A%0A%0A%60%60%60C%2B%2B%0Apublic%3A%0A%20%20%20%20void%20AdjustLayout()%3B%0A%60%60%60%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2215%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20MFCApp%20project%2C%20select%20%3CSTRONG%3EClass%20Wizard%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%229.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167379iAC8A42F2A07337D9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%229.png%22%20alt%3D%229.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAdd%20a%20handler%20to%20handle%20WM_SIZE%20so%20that%20when%20view%20size%20changes%20we%20can%20handle%20it%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2210.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167380i09E5CC2D3B241224%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2210.png%22%20alt%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EModify%20the%20OnSize%20method%20handler%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AOnSize(UINT%20nType%2C%20int%20cx%2C%20int%20cy)%0A%7B%0A%20%20%20%20CView%3A%3AOnSize(nType%2C%20cx%2C%20cy)%3B%0A%20%20%20%20AdjustLayout()%3B%0A%7D%0A%60%60%60%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2217%22%20type%3D%221%22%3E%0A%3CLI%3ENow%20you%20can%20build%20and%20run%20this%20MFCApp.%20It%20should%20display%20a%20button%20in%20the%20central%20of%20view%20window%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F21.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2221.gif%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167381iF2614F3937B6530F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2221.gif%22%20alt%3D%2221.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22using-winui-in-uwp-custom-control-in-myapp-uwp-project%22%20id%3D%22toc-hId--1180974918%22%20id%3D%22toc-hId--401880625%22%20id%3D%22toc-hId--1761997365%22%3EUsing%20WinUI%20in%20UWP%20Custom%20Control%20in%20MyApp%20UWP%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EIn%20MyApp%2C%20let%E2%80%99s%20add%20the%20%3CSTRONG%3E%3CEM%3EMicrosoft.UI.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%20nuget%20package%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F22.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2222.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167382iC0BA586A67E97EFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2222.png%22%20alt%3D%2222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%5B!NOTE%5D%20It%20is%20possible%20some%20version%20of%20WinUI%20nuget%20package%20doesn%E2%80%99t%20create%20Microsoft.UI.Xaml.Controls%20class%20registering%20info%20into%20AppxManifest.xml%2C%20which%20is%20required%20by%20MFCApp%20later.%20This%20version%20used%20above%20works%20well.%20If%20you%20found%20MFCApp%20failed%20to%20run%20with%20%E2%80%9CClass%20is%20not%20registered%E2%80%9D%20error%2C%20please%20try%20this%20version.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EModify%20App.Xaml%2C%20TreeViewUserControl.Xaml%2C%20pch.h%20and%20TreeViewUserContro.cpp%20as%20below%3A%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EFor%20detailed%20reasons%20on%20modifying%20these%20files%2C%20can%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Fsimple-winui-example%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAdd%20the%20Windows%20UI%20(WinUI)%20Theme%20Resources%20to%20%3CSTRONG%3E%3CEM%3EApp.Xmal%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb20%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AMSMarkup%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Markup%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION.RESOURCES%3E%3C%2FXAMLAPPLICATION.RESOURCES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLCONTROLSRESOURCES%3E%3C%2FXAMLCONTROLSRESOURCES%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20WinUI%20reference%20and%20WinUI%20TreeView%20control%20in%20%3CSTRONG%3E%3CEM%3ETreeViewUserControl.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb21%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CUSERCONTROL%3E%3C%2FUSERCONTROL%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amuxc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CSTACKPANEL%3E%3C%2FSTACKPANEL%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Orientation%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Horizontal%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20HorizontalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20VerticalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CBUTTON%3E%3C%2FBUTTON%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Button%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Click%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22ClickHandler%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3EClick%20Me%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW%3E%3C%2FTREEVIEW%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22WinUITreeView%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW.ROOTNODES%3E%3C%2FTREEVIEW.ROOTNODES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Flavors%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20IsExpanded%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22True%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE.CHILDREN%3E%3C%2FTREEVIEWNODE.CHILDREN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Vanilla%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Strawberry%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Chocolate%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EInclude%20WinUI%20winrt%20header%20files%20in%20%3CSTRONG%3E%3CEM%3Epch.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb22%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.Controls.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.XamlTypeInfo.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ETreeViewUserControl.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb23%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22dt%22%3Evoid%3C%2FSPAN%3E%20TreeViewUserControl%3A%3AClickHandler(IInspectable%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%2C%20RoutedEventArgs%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Button().Content(box_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%20tn%20%3D%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20tn.Content(winrt%3A%3Abox_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20WinUITreeView().RootNodes().First().Current().Children().Append(tn)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3EBuild%20and%20run%20MFCApp%2C%20if%20steps%20have%20been%20taken%20exactly%20as%20above%2C%20it%20will%20show%20as%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F23.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2223.gif%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167383iD458144BF092A07C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2223.gif%22%20alt%3D%2223.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22wrap-up%22%20id%3D%22toc-hId-1306537915%22%20id%3D%22toc-hId-2085632208%22%20id%3D%22toc-hId-725515468%22%3EWrap%20Up%3C%2FH2%3E%0A%3CP%3EThis%20article%20gives%20detailed%20steps%20on%20how%20to%20leverage%20XamplApplication%20to%20host%20custom%20XAML%20control%20in%20document%20view%20of%20traditional%20MFC%20Mulitple%20Document%20Interface%20project%2C%20and%20the%20important%20thing%20is%20you%20can%20use%20WinUI%20to%20modernize%20the%20MFC%20application%20now.%20The%20whole%20smaple%20solution%20can%20be%20found%20from%20this%20repo%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%3C%2FA%3E%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1130087%22%20slang%3D%22en-US%22%3EHost%20Custom%20UWP%20Controls%20in%20MFC%20MDI%20Project%20using%20XAML%20Islands%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1130087%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22host-custom-uwp-controls-in-mfc-mdi-project-using-xaml-islands%22%20id%3D%22toc-hId-383255794%22%20id%3D%22toc-hId--1211021714%22%3EHost%20Custom%20UWP%20Controls%20in%20MFC%20MDI%20Project%20using%20XAML%20Islands%3C%2FH1%3E%0A%3CP%3EThis%20article%20explains%20how%20to%20modernize%20MFC%20MDI%20project%20with%20custom%20UWP%20Controls%20through%20XAML%20Islands.%20With%20custom%20UWP%20controls%2C%20it%20allows%20us%20to%20define%20control%20layout%20easily%20through%20XAML%20pages.%20Not%20only%20putting%20standard%20UWP%20controls%20into%20the%20custom%20control%2C%20we%20can%20also%20integrate%20other%20custom%20controls%20as%20well%2C%20such%20as%20latest%20WinUI%20controls.%20We%20will%20use%20a%20new%20Xaml%20Application%20project%20to%20bring%20the%20custom%20UWP%20controls%20into%20our%20MFC%20project.%20This%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fapps%2Fdesktop%2Fmodernize%2Fusing-the-xaml-hosting-api%23host-a-custom-uwp-control%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%20has%20mentioned%20how%20to%20use%20the%20new%20XAML%20application%20in%20Win32%20C%2B%2B%20application%2C%20we%20will%20give%20more%20detailed%20steps%20for%20MFC%20project.%3C%2FP%3E%0A%3CP%3EOverall%2C%20in%20our%20MFC%20project%2C%20we%20will%20have%20two%20parts%20to%20demonstrate%20this%20method%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMFC%20MDI%20Project%3C%2FLI%3E%0A%3CLI%3EA%20companion%20UWP%20app%20project%20that%20defines%20a%20XamlApplication%20object.%3CBR%20%2F%3EIn%20this%20project%2C%20we%20will%20define%20a%20custom%20UWP%20control%20and%20export%20it%20so%20that%20MFC%20can%20use%20the%20custom%20UWP%20control.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22development-environment%22%20id%3D%22toc-hId-1073817268%22%20id%3D%22toc-hId-1405573838%22%3EDevelopment%20Environment%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3EVisual%20Studio%202019%20(16.3.6)%3C%2FLI%3E%0A%3CLI%3EWindows%2010%201909%20(18363.476)%3C%2FLI%3E%0A%3CLI%3EWindows%2010%20SDK%20(10.0.18362.1)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22configure-mfc-project%22%20id%3D%22toc-hId--733637195%22%20id%3D%22toc-hId--401880625%22%3EConfigure%20MFC%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3E%3CP%3ECreate%20MFC%20App%20in%20Visual%20Studio%202019%2C%20will%20name%20it%20MFCAPP%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%220.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167348i781633E431A9536A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%220.png%22%20alt%3D%220.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EUse%20below%20configuration%20to%20create%20the%20MFCAPP%20project%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167349i41F7B0095AADEB9C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%221.png%22%20alt%3D%221.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eclick%20%3CSTRONG%3EFinish%3C%2FSTRONG%3E%20Build%20and%20Run%20it%2C%20here%20is%20its%20default%20UI%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F2.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167350iD4329592FAF62E5E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%222.png%22%20alt%3D%222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIn%20Solution%20Explorer%2C%20right-click%20the%20MFCAPP%20project%20node%2C%20click%20%3CSTRONG%3ERetarget%20Project%3C%2FSTRONG%3E%2C%20select%20the%20%3CSTRONG%3E10.0.18362.0%3C%2FSTRONG%3E%20or%20a%20later%20SDK%20release%2C%20and%20then%20click%20OK.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%223.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167351iE8C58CBB8639FD5C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%223.png%22%20alt%3D%223.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%224.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167352i98004B7D6884BEA0%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%224.png%22%20alt%3D%224.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20the%20Microsoft.Windows.CppWinRT%20NuGet%20package%3A%3C%2FP%3E%0A%3COL%20type%3D%22a%22%3E%0A%3CLI%3ERight-click%20the%20project%20in%20Solution%20Explorer%20and%20choose%20%3CSTRONG%3E%3CEM%3EManage%20NuGet%20Packages%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20Browse%20tab%2C%20search%20for%20the%20%3CSTRONG%3EMicrosoft.Windows.CppWinRT%3C%2FSTRONG%3E%20package%2C%20and%20install%20the%20latest%20version%20of%20this%20package.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F5.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%225.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167353i97CAB78D300F0E21%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%225.png%22%20alt%3D%225.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CP%3EAfter%20install%20the%20nuget%20package%2C%20check%20the%20MFC%20project%20properties%2C%20you%20will%20notice%20its%20C%2B%2B%20version%20is%20ISO%20C%2B%2B17%2C%20which%20is%20required%20by%20C%2B%2B%2FWinRT%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F6.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%226.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167354i6E18E4D53778DD37%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%226.png%22%20alt%3D%226.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CP%3EBuild%20this%20MFCApp%2C%20we%20can%20see%20winrt%20projected%20files%20are%20generated%20in%20the%20%E2%80%9CGenerated%20Files%E2%80%9D%20folder%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F7.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%227.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167356i09D3F8532E8B606A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%227.png%22%20alt%3D%227.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20the%20%3CSTRONG%3EMicrosoft.Toolkit.Win32.UI.SDK%3C%2FSTRONG%3E%20NuGet%20package%3A%3C%2FP%3E%0A%3COL%20type%3D%22a%22%3E%0A%3CLI%3EIn%20the%20NuGet%20Package%20Manager%20window%2C%20make%20sure%20that%20Include%20prerelease%20is%20selected.%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20Browse%20tab%2C%20search%20for%20the%20%3CSTRONG%3EMicrosoft.Toolkit.Win32.UI.SDK%3C%2FSTRONG%3E%20package%2C%20and%20install%20version%20v6.0.0%20(or%20Later)%20of%20this%20package.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F8.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%228.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167357i987888C7C9B9A1F8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%228.png%22%20alt%3D%228.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20the%20%3CSTRONG%3E%3CEM%3EMicrosoft.VCRTForwarders.140%3C%2FEM%3E%3C%2FSTRONG%3E%20nuget%20package%20as%20well.%20Running%20Custom%20UWP%20Control%20in%20this%20project%20will%20require%20VC%20libs.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F18.png%22%20border%3D%220%22%20width%3D%22300%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22configure-uwp-project%22%20id%3D%22toc-hId-1753875638%22%20id%3D%22toc-hId-2085632208%22%3EConfigure%20UWP%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3E%3CP%3EIn%20Solution%20Explorer%2C%20right-click%20the%20solution%20node%20and%20select%20Add%20-%26gt%3B%20New%20Project.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EAdd%20a%20Blank%20App%20(C%2B%2B%2FWinRT)%20project%20to%20your%20solution.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167360iEE6C68C35F30BB8D%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%221.png%22%20alt%3D%221.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CSPAN%3ENote%3A%20Please%20make%20sure%20this%20is%20C%2B%2B%2FWinRT%20template.%20If%20cannot%20find%20it%2C%20you'll%20want%20to%20download%20and%20install%20the%20latest%20version%20of%20the%26nbsp%3B%3C%2FSPAN%3E%3CU%3E%3CA%20title%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3Fitemname%3Dcppwinrtteam.cppwinrt101804264%22%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3DCppWinRTTeam.cppwinrt101804264%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%5B%23%24dp105%5DC%2B%2B%2FWinRT%20Visual%20Studio%20Extension%20(VSIX)%3C%2FU%3E%3C%2FA%3E%3CU%3E%3C%2FU%3E%3C%2FU%3E%3CSPAN%3E%3CSPAN%3E%26nbsp%3Bfrom%20the%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CU%3E%3CA%20title%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2F%22%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%5B%23%24dp106%5DVisual%20Studio%20Marketplace%3C%2FU%3E%3C%2FA%3E%3CU%3E%3C%2FU%3E%3C%2FU%3E%3CSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EGive%20it%20a%20name%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20and%20create%20it%2C%20Make%20sure%20the%20target%20version%20and%20minimum%20version%20are%20%3CSTRONG%3E%3CEM%3Eboth%3C%2FEM%3E%3C%2FSTRONG%3E%20set%20to%20%3CSTRONG%3E%3CEM%3EWindows%2010%2C%20version%201903%3C%2FEM%3E%3C%2FSTRONG%3E%20or%20later.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ERight%20click%20the%20MyApp%20and%20open%20its%20properties%2C%20make%20sure%20its%20C%2B%2B%2FWinRT%20configuration%20is%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%223.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167362iFF88DC17956377B5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%223.png%22%20alt%3D%223.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EChange%20its%20output%20type%20from%20.EXE%20to%20Dynamic%20Library%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%224.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167363i73A4CBA4D253E329%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%224.png%22%20alt%3D%224.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ESave%20a%20dummy.exe%20into%20the%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20folder.%20It%20doesn%E2%80%99t%20need%20to%20be%20a%20real%20exe%2C%20just%20input%20%E2%80%9Cdummy%20exe%20file%E2%80%9D%20in%20notepad%2C%20and%20save%20it%20as%20%3CSTRONG%3E%3CEM%3Edummy.exe%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%225.png%22%20style%3D%22width%3A%20200px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167364i4711A20C146B90C0%2Fimage-size%2Fsmall%3Fv%3D1.0%26amp%3Bpx%3D200%22%20title%3D%225.png%22%20alt%3D%225.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%226.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167365iD271467D6B93EC5F%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%226.png%22%20alt%3D%226.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EMake%20sure%20the%20Content%20property%20of%20dummy.exe%20is%20%3CSTRONG%3E%3CEM%3ETrue%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%226.1.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167366iC77BE3EDBB85F2E2%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%226.1.png%22%20alt%3D%226.1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ENow%20edit%20Package.appxmanifest%2C%20change%20the%20Executable%20attribute%20to%20%E2%80%9Cdummy.exe%E2%80%9D%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F7.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%227.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167368i0519876256EEEF12%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%227.png%22%20alt%3D%227.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%228%22%20type%3D%221%22%3E%0A%3CLI%3E%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EUnload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EEdit%20MyApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EAdd%20below%20properties%20to%20the%20%3CSTRONG%3E%3CEM%3EMyApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb1%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Label%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Globals%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CWINDOWSAPPCONTAINER%3E%3C%2FWINDOWSAPPCONTAINER%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXGENERATEPRIENABLED%3E%3C%2FAPPXGENERATEPRIENABLED%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROJECTPRIINDEXNAME%3E%3C%2FPROJECTPRIINDEXNAME%3E%3C%2FSPAN%3EApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXPACKAGE%3E%3C%2FAPPXPACKAGE%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CP%3EFor%20example%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F8.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%228.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167369i7D9AEF4203B7BA42%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%228.png%22%20alt%3D%228.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMyApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMainpage.xml%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3ERemove%3C%2FEM%3E%3C%2FSTRONG%3E.%20And%20then%20click%20%3CSTRONG%3E%3CEM%3EDelete%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECopy%20App.Xaml%2C%20App.cpp%2C%20App.h%2C%20App.idl%20contents%20to%20overwrite%20current%20ones%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb2%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb3%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22pch.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20App%3A%3AApp()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Initialize()%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20AddRef()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22va%22%3Em_inner%3C%2FSPAN%3E.as%26lt%3B%3A%3AIUnknown%26gt%3B()-%26gt%3BRelease()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20App%3A%3A~App()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb4%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%20Declaration%20of%20the%20App%20class.%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22co%22%3E%2F%2F%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.g.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22App.base.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT2%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20~App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Afactory_implementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eclass%3C%2FSPAN%3E%20App%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20AppT%3CAPP%3E%3C%2FAPP%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EApp.idl%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb5%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20MyApp%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%5Bdefault_interface%5D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20runtimeclass%20App%3A%20Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20App()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3ECreate%20app.base.h%20in%20this%20project%2C%20and%20use%20below%20content%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3Eapp.base.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb6%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20once%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3A%3AMyApp%3A%3Aimplementation%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Estruct%3C%2FSPAN%3E%20App_baseWithProvider%20%3A%20%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%20App_base%3CD%3E%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20IXamlType%20%3D%20%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AIXamlType%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AInterop%3A%3ATypeName%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20type)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(type)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20IXamlType%20GetXamlType(%3A%3Awinrt%3A%3Ahstring%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%20fullName)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXamlType(fullName)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3Awinrt%3A%3Acom_array%26lt%3B%3A%3Awinrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AMarkup%3A%3AXmlnsDefinition%26gt%3B%20GetXmlnsDefinitions()%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20AppProvider()-%26gt%3BGetXmlnsDefinitions()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22dt%22%3Ebool%3C%2FSPAN%3E%20_contentLoaded%7B%20%3CSPAN%20class%3D%22kw%22%3Efalse%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20_appProvider%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Eshared_ptr%3CXAMLMETADATAPROVIDER%3E%20AppProvider()%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(!_appProvider)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20_appProvider%20%3D%20%3CSPAN%20class%3D%22bu%22%3Estd%3A%3A%3C%2FSPAN%3Emake_shared%3CXAMLMETADATAPROVIDER%3E()%3B%3C%2FXAMLMETADATAPROVIDER%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Ereturn%3C%2FSPAN%3E%20_appProvider%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Etemplate%3C%2FSPAN%3E%20%26lt%3B%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E%20D%2C%20%3CSPAN%20class%3D%22kw%22%3Etypename%3C%2FSPAN%3E...%20I%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20AppT2%20%3D%20App_baseWithProvider%3CD%3E%3B%3C%2FD%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2214%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EInstall%20%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Toolkit.Win32.UI.XamlApplication%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Toolkit.Win32.UI.XamlApplication%3C%2FA%3E%20Nuget%20package.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EIf%20you%20build%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%20now%2C%20it%20should%20create%20MyApp.dll%20without%20any%20error.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22centralize-output-input-and-cwinrt-files-in-solution%22%20id%3D%22toc-hId--53578825%22%20id%3D%22toc-hId-278177745%22%3ECentralize%20Output%2C%20Input%20and%20C%2B%2B%2FWinRT%20files%20in%20Solution%3C%2FH2%3E%0A%3CP%3EThis%20step%20is%20necessary%20for%20our%20next%20steps%20because%20we%20need%20to%20include%20winrt%20header%20files%20in%20different%20projects%20properly%2C%20and%20MFCApp%20also%20needs%20to%20reference%20MyApp%20resource%20files.%3C%2FP%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20a%20new%20Solution.Props%20file%20by%20right%20clicking%20the%20solution%20node%2C%20and%20select%20Add%20-%26gt%3B%20New%20Item%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F13.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2213.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167370i9317B7F41B450E97%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2213.png%22%20alt%3D%2213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3EUse%20below%20content%20to%20overwrite%20the%20Solution.Props%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb7%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CPROJECT%3E%3C%2FPROJECT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fdeveloper%2Fmsbuild%2F2003%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CINTDIR%3E%3C%2FINTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3COUTDIR%3E%3C%2FOUTDIR%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(MSBuildProjectName)%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CGENERATEDFILESDIR%3E%3C%2FGENERATEDFILESDIR%3E%3C%2FSPAN%3E%24(IntDir)Generated%20Files%5C%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClick%20Views%20-%26gt%3B%20Other%20Windows%20-%26gt%3B%20Property%20Manager%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2214.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167371i99C4B3F810979B02%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2214.png%22%20alt%3D%2214.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EAdd%20Existing%20Property%20Sheet%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20add%20the%20new%20%3CSTRONG%3E%3CEM%3Esolution.props%3C%2FEM%3E%3C%2FSTRONG%3E%20file%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2215.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167372iA5094D41B6ABB36A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2215.png%22%20alt%3D%2215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%204.%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%20We%20can%20close%20the%20Property%20Manager%20window%20now.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20project%20node%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Properties.%20Set%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOutput%20Directory%3A%20%24(OutDir)%3C%2FP%3E%0A%3CP%3EIntermidia%20Directory%3A%20%24(IntDir)%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167373i654BE14390759307%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2212.png%22%20alt%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%227%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERepeat%20the%20step%206%20for%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Solution%20node%2C%20and%20choose%20%3CSTRONG%3E%3CEM%3EProject%20Dependencies%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20make%20sure%20MFCApp%20depends%20on%20MyApp%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2216.png%22%20style%3D%22width%3A%20373px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167374i0A604407051580F8%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2216.png%22%20alt%3D%2216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERebuild%20the%20whole%20solution%2C%20it%20should%20work%20without%20errors.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22add-uwp-custom-xaml-control-to-myapp%22%20id%3D%22toc-hId--1861033288%22%20id%3D%22toc-hId--831114777%22%3EAdd%20UWP%20Custom%20XAML%20Control%20to%20MyApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMyApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20Add%20-%26gt%3B%20New%20Item%3C%2FLI%3E%0A%3CLI%3ECreate%20%3CSTRONG%3E%3CEM%3EBlank%20User%20Conrol%20(C%2B%2B%2FWinRT)%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20here%20we%20call%20it%20TreeViewUserControl%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2210.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167375i1E33193771A456A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2210.png%22%20alt%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22integrate-custom-xaml-control-in-mfcapp%22%20id%3D%22toc-hId-626479545%22%20id%3D%22toc-hId-1656398056%22%3EIntegrate%20Custom%20XAML%20Control%20in%20MFCApp%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EAdd%20one%20%3CSTRONG%3Eapp.manifest%3C%2FSTRONG%3E%20in%20your%20project%20with%20below%20content%20to%20register%20custom%20control%20type%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb8%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%20version%3D%221.0%22%20encoding%3D%22utf-8%22%20standalone%3D%22yes%22%3CSPAN%20class%3D%22kw%22%3E%3F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CASSEMBLY%3E%3C%2FASSEMBLY%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v1%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Aasmv3%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Aasm.v3%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20manifestVersion%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%221.0%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CFILE%3E%3C%2FFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.XamlMetadataProvider%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CACTIVATABLECLASS%3E%3C%2FACTIVATABLECLASS%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20name%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20threadingModel%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22both%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22urn%3Aschemas-microsoft-com%3Awinrt.v1%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ENow%20the%20project%20structure%20is%20like%20as%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2212.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167376i5303F7EAD8E4D306%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%2212.png%22%20alt%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20Win32%20Project%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EUnload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EEdit%20MFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERemove%20the%20three%20lines%20from%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb9%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20below%20properties%20to%20the%20%3CSTRONG%3E%3CEM%3EMFCApp.vcxproj%3C%2FEM%3E%3C%2FSTRONG%3E%20project%20file%20before%20the%20%3CSTRONG%3E%3CEM%3E%E2%80%9C%3CIMPORT%20project%3D%22%E2%80%9D%E2%80%9C%24(VCTargetsPath).Cpp.targets%E2%80%9D%22%3E%3C%2FIMPORT%3E%22%3C%2FEM%3E%3C%2FSTRONG%3E%20line%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb10%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CMANIFEST%3E%3C%2FMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22app.manifest%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPXMANIFEST%3E%3C%2FAPPXMANIFEST%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CAppxManifest.xml%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPPROJECTNAME%3E%3C%2FAPPPROJECTNAME%3E%3C%2FSPAN%3EMyApp%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CPROPERTYGROUP%3E%3C%2FPROPERTYGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CAPPINCLUDEDIRECTORIES%3E%3C%2FAPPINCLUDEDIRECTORIES%3E%3C%2FSPAN%3E%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C%3B%24(SolutionDir)%5Cobj%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5CGenerated%20Files%5C%3B%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.xbf%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5C*.dll%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CNATIVEREFERENCEFILE%3E%3C%2FNATIVEREFERENCEFILE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Include%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(SolutionDir)%5Cbin%5C%24(Platform)%5C%24(Configuration)%5C%24(AppProjectName)%5Cresources.pri%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CDEPLOYMENTCONTENT%3E%3C%2FDEPLOYMENTCONTENT%3E%3C%2FSPAN%3Etrue%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CCOPYTOOUTPUTDIRECTORY%3E%3C%2FCOPYTOOUTPUTDIRECTORY%3E%3C%2FSPAN%3EPreserveNewest%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22er%22%3E%26lt%3B%3C%2FSPAN%3E------Right%20Here---------%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%3CSPAN%20class%3D%22kw%22%3E%3CIMPORT%3E%3C%2FIMPORT%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Project%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22%24(VCTargetsPath)%5CMicrosoft.Cpp.targets%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%226%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20%3CSTRONG%3E%3CEM%3EMFCApp%20(Unloaded)%3C%2FEM%3E%3C%2FSTRONG%3E%20project%2C%20select%20%3CSTRONG%3E%3CEM%3EReload%20Project%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20%3CSTRONG%3E%3CEM%3EMFCApp%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3E%3CEM%3EProperties%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20setup%20%3CSTRONG%3E%3CEM%3E%24(AppIncludeDirectories)%3C%2FEM%3E%3C%2FSTRONG%3E%20as%20a%20part%20of%20include%20file%20path%2C%20this%20macro%20has%20been%20defined%20in%20the%20above%20project%20file%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2217.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167377iD516CE1E12CD539C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2217.png%22%20alt%3D%2217.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESet%20%3CSTRONG%3E%3CEM%3E%E2%80%9CPer%20Monitor%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20for%20%3CSTRONG%3E%3CEM%3EDPI%20Awareness%3C%2FEM%3E%3C%2FSTRONG%3E%20otherwise%20you%20may%20be%20not%20able%20to%20start%20this%20MFCApp%20when%20it%20is%20%3CSTRONG%3E%3CEM%3E%E2%80%9CHigh%20DPI%20Aware%E2%80%9D%3C%2FEM%3E%3C%2FSTRONG%3E%20and%20hit%20configuration%20error%20in%20Manifest%3A%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2219.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167378iA9F1AA239C7E1B2D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2219.png%22%20alt%3D%2219.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F19.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3COL%20start%3D%229%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EOpen%20pch.h%2C%20add%20below%20code%20to%20include%20necessary%20winrt%20header%20files%3A%3C%2FP%3E%0A%3CDIV%20id%3D%22cb11%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20push_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20GetCurrentTime%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23undef%20TRY%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FWINDOWS.UI.XAML.HOSTING.DESKTOPWINDOWXAMLSOURCE.H%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%3CWINRT%3E%3C%2FWINRT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22TRY%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23pragma%20pop_macro(%22GetCurrentTime%22)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ERegarding%20the%20reason%20of%20using%20%E2%80%9CGetCurrentTime%E2%80%9D%20and%20%E2%80%9CTRY%E2%80%9D%20macros%2C%20please%20refer%20to%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Ffaq%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EUsing%20winrt%20namespaces%20in%20MFCAPPView.h%20and%20MFCAPP.h%3C%2FP%3E%0A%3CDIV%20id%3D%22cb12%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20winrt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AComposition%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AHosting%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AFoundation%3A%3ANumerics%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kw%22%3Enamespace%3C%2FSPAN%3E%20Windows%3A%3AUI%3A%3AXaml%3A%3AControls%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EDeclare%20hostApp%20in%20%3CSTRONG%3E%3CEM%3EMFCApp.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb13%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Epublic%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3AApp%20hostApp%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EInitalize%20hostApp%20right%20before%20new%20CMainFrame%20in%20%3CSTRONG%3E%3CEM%3ECMFCAppApp%3A%3AInitInstance()%3C%2FEM%3E%3C%2FSTRONG%3E%20in%20MFCApp.CPP%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb14%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%20%20%20%20hostApp%20%3D%20winrt%3A%3AMyApp%3A%3AApp%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%26lt%3B---Right%20Here---%26gt%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22co%22%3E%2F%2F%20create%20main%20MDI%20Frame%20window%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20CMainFrame*%20pMainFrame%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enew%3C%2FSPAN%3E%20CMainFrame%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2211%22%20type%3D%221%22%3E%0A%3CLI%3EDeclare%20_desktopWindowXamlSource%20and%20our%20custom%20control%20in%20MFCAppView.h%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb15%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3Eprivate%3C%2FSPAN%3E%3A%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AWindows%3A%3AUI%3A%3AXaml%3A%3AHosting%3A%3ADesktopWindowXamlSource%20_desktopWindowXamlSource%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl%20_treeViewUserControl%7B%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%20%7D%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2212%22%20type%3D%221%22%3E%0A%3CLI%3EInitialize%20_desktopWindowXamlSource%20and%20custom%20control%20in%20MFCAppView.cpp%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20id%3D%22cb16%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20%3D%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%20%20%20%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource%20%3D%20DesktopWindowXamlSource%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3Eauto%3C%2FSPAN%3E%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3BAttachToWindow(GetSafeHwnd()))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20_treeViewUserControl%20%3D%20winrt%3A%3AMyApp%3A%3ATreeViewUserControl()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20_desktopWindowXamlSource.Content(_treeViewUserControl)%3B%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20RECT%20windowRect%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22dv%22%3E0%3C%2FSPAN%3E%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%2213%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EClean%20up%20resources%20when%20the%20view%20is%20disconstructed%20in%20MFCAppView.cpp%3C%2FP%3E%0A%3CDIV%20id%3D%22cb17%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3ECMFCAppView%3A%3A~CMFCAppView()%3C%2FSPAN%3E%0A%3CSPAN%3E%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22cf%22%3Eif%3C%2FSPAN%3E%20(_desktopWindowXamlSource%20!%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource.Close()%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20_desktopWindowXamlSource%20%3D%20%3CSPAN%20class%3D%22kw%22%3Enullptr%3C%2FSPAN%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%0A%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EAdd%20AdjustLayout%20function%20to%20make%20XAML%20content%20layout%20properly%20in%20MFCAppView.cpp%20%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AAdjustLayout()%0A%7B%0A%20%20%20%20if%20(_desktopWindowXamlSource%20!%3D%20nullptr)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20auto%20interop%20%3D%20_desktopWindowXamlSource.as%3CIDESKTOPWINDOWXAMLSOURCENATIVE%3E()%3B%0A%20%20%20%20%20%20%20%20HWND%20xamlHostHwnd%20%3D%20NULL%3B%0A%20%20%20%20%20%20%20%20check_hresult(interop-%26gt%3Bget_WindowHandle(%26amp%3BxamlHostHwnd))%3B%0A%0A%20%20%20%20%20%20%20%20RECT%20windowRect%3B%0A%20%20%20%20%20%20%20%20GetWindowRect(%26amp%3BwindowRect)%3B%0A%20%20%20%20%20%20%20%20%3A%3ASetWindowPos(xamlHostHwnd%2C%20NULL%2C%200%2C%200%2C%20windowRect.right%20-%20windowRect.left%2C%20windowRect.bottom%20-%20windowRect.top%2C%20SWP_SHOWWINDOW)%3B%0A%20%20%20%20%7D%0A%7D%0A%60%60%60%0A%0ADon't%20forget%20to%20declare%20it%20in%20MFCAppView.h%3A%0A%0A%60%60%60C%2B%2B%0Apublic%3A%0A%20%20%20%20void%20AdjustLayout()%3B%0A%60%60%60%3C%2FIDESKTOPWINDOWXAMLSOURCENATIVE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2215%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3ERight%20click%20the%20MFCApp%20project%2C%20select%20%3CSTRONG%3EClass%20Wizard%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%229.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167379iAC8A42F2A07337D9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%229.png%22%20alt%3D%229.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAdd%20a%20handler%20to%20handle%20WM_SIZE%20so%20that%20when%20view%20size%20changes%20we%20can%20handle%20it%3A%3C%2FP%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFC%2F10.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2210.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167380i09E5CC2D3B241224%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2210.png%22%20alt%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EModify%20the%20OnSize%20method%20handler%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CPRE%3E%3CCODE%3E%60%60%60C%2B%2B%0Avoid%20CMFCAppView%3A%3AOnSize(UINT%20nType%2C%20int%20cx%2C%20int%20cy)%0A%7B%0A%20%20%20%20CView%3A%3AOnSize(nType%2C%20cx%2C%20cy)%3B%0A%20%20%20%20AdjustLayout()%3B%0A%7D%0A%60%60%60%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20start%3D%2217%22%20type%3D%221%22%3E%0A%3CLI%3ENow%20you%20can%20build%20and%20run%20this%20MFCApp.%20It%20should%20display%20a%20button%20in%20the%20central%20of%20view%20window%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F21.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2221.gif%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167381iF2614F3937B6530F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2221.gif%22%20alt%3D%2221.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22using-winui-in-uwp-custom-control-in-myapp-uwp-project%22%20id%3D%22toc-hId--1180974918%22%20id%3D%22toc-hId--151056407%22%3EUsing%20WinUI%20in%20UWP%20Custom%20Control%20in%20MyApp%20UWP%20Project%3C%2FH2%3E%0A%3COL%20type%3D%221%22%3E%0A%3CLI%3EIn%20MyApp%2C%20let%E2%80%99s%20add%20the%20%3CSTRONG%3E%3CEM%3EMicrosoft.UI.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%20nuget%20package%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F22.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2222.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167382iC0BA586A67E97EFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2222.png%22%20alt%3D%2222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3E%5B!NOTE%5D%20It%20is%20possible%20some%20version%20of%20WinUI%20nuget%20package%20doesn%E2%80%99t%20create%20Microsoft.UI.Xaml.Controls%20class%20registering%20info%20into%20AppxManifest.xml%2C%20which%20is%20required%20by%20MFCApp%20later.%20This%20version%20used%20above%20works%20well.%20If%20you%20found%20MFCApp%20failed%20to%20run%20with%20%E2%80%9CClass%20is%20not%20registered%E2%80%9D%20error%2C%20please%20try%20this%20version.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3COL%20start%3D%222%22%20type%3D%221%22%3E%0A%3CLI%3E%0A%3CP%3EModify%20App.Xaml%2C%20TreeViewUserControl.Xaml%2C%20pch.h%20and%20TreeViewUserContro.cpp%20as%20below%3A%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EFor%20detailed%20reasons%20on%20modifying%20these%20files%2C%20can%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fcpp-and-winrt-apis%2Fsimple-winui-example%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EAdd%20the%20Windows%20UI%20(WinUI)%20Theme%20Resources%20to%20%3CSTRONG%3E%3CEM%3EApp.Xmal%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb20%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION%3E%3C%2FXAMLAPPLICATION%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.App%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AToolkit%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.Toolkit.Win32.UI.XamlHost%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3AMSMarkup%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Markup%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20RequestedTheme%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Light%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLAPPLICATION.RESOURCES%3E%3C%2FXAMLAPPLICATION.RESOURCES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CXAMLCONTROLSRESOURCES%3E%3C%2FXAMLCONTROLSRESOURCES%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAdd%20WinUI%20reference%20and%20WinUI%20TreeView%20control%20in%20%3CSTRONG%3E%3CEM%3ETreeViewUserControl.Xaml%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb21%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20xml%22%3E%3CCODE%20class%3D%22sourceCode%20xml%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3CUSERCONTROL%3E%3C%2FUSERCONTROL%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20x%3AClass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22MyApp.TreeViewUserControl%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%2Fpresentation%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ax%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fwinfx%2F2006%2Fxaml%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Alocal%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMyApp%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amuxc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22using%3AMicrosoft.UI.Xaml.Controls%22%3C%2FSPAN%3E%20%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Ad%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fexpression%2Fblend%2F2008%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20xmlns%3Amc%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22http%3A%2F%2Fschemas.openxmlformats.org%2Fmarkup-compatibility%2F2006%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20mc%3AIgnorable%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22d%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CSTACKPANEL%3E%3C%2FSTACKPANEL%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Orientation%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Horizontal%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20HorizontalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20VerticalAlignment%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CBUTTON%3E%3C%2FBUTTON%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Button%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Click%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22ClickHandler%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3EClick%20Me%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW%3E%3C%2FTREEVIEW%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20x%3AName%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22WinUITreeView%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEW.ROOTNODES%3E%3C%2FTREEVIEW.ROOTNODES%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Flavors%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20IsExpanded%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22True%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE.CHILDREN%3E%3C%2FTREEVIEWNODE.CHILDREN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Vanilla%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Strawberry%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3CTREEVIEWNODE%3E%3C%2FTREEVIEWNODE%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22ot%22%3E%20Content%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22st%22%3E%22Chocolate%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%2F%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22kw%22%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EInclude%20WinUI%20winrt%20header%20files%20in%20%3CSTRONG%3E%3CEM%3Epch.h%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb22%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.Controls.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%3E%3CSPAN%20class%3D%22pp%22%3E%23include%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22im%22%3E%22winrt%2FMicrosoft.UI.Xaml.XamlTypeInfo.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ETreeViewUserControl.cpp%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22cb23%22%20class%3D%22sourceCode%22%3E%0A%3CPRE%20class%3D%22sourceCode%20c%2B%2B%22%3E%3CCODE%20class%3D%22sourceCode%20cpp%22%3E%3CSPAN%3E%3CSPAN%20class%3D%22dt%22%3Evoid%3C%2FSPAN%3E%20TreeViewUserControl%3A%3AClickHandler(IInspectable%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B%2C%20RoutedEventArgs%20%3CSPAN%20class%3D%22at%22%3Econst%3C%2FSPAN%3E%26amp%3B)%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20Button().Content(box_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%20tn%20%3D%20winrt%3A%3AMicrosoft%3A%3AUI%3A%3AXaml%3A%3AControls%3A%3ATreeViewNode%7B%7D%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20tn.Content(winrt%3A%3Abox_value(%3CSPAN%20class%3D%22st%22%3EL%22Clicked%22%3C%2FSPAN%3E))%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%20%20%20%20WinUITreeView().RootNodes().First().Current().Children().Append(tn)%3B%3C%2FSPAN%3E%0A%3CSPAN%3E%20%20%20%20%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3COL%20start%3D%223%22%20type%3D%221%22%3E%0A%3CLI%3EBuild%20and%20run%20MFCApp%2C%20if%20steps%20have%20been%20taken%20exactly%20as%20above%2C%20it%20will%20show%20as%20below%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CFIGURE%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2F..%2Fimages%2FMFCCustomControl%2F23.gif%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%0A%3CFIGCAPTION%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2223.gif%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167383iD458144BF092A07C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2223.gif%22%20alt%3D%2223.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFIGCAPTION%3E%0A%3C%2FFIGURE%3E%0A%3CH2%20id%3D%22wrap-up%22%20id%3D%22toc-hId-1306537915%22%20id%3D%22toc-hId--1958510870%22%3EWrap%20Up%3C%2FH2%3E%0A%3CP%3EThis%20article%20gives%20detailed%20steps%20on%20how%20to%20leverage%20XamplApplication%20to%20host%20custom%20XAML%20control%20in%20document%20view%20of%20traditional%20MFC%20Mulitple%20Document%20Interface%20project%2C%20and%20the%20important%20thing%20is%20you%20can%20use%20WinUI%20to%20modernize%20the%20MFC%20application%20now.%20The%20whole%20smaple%20solution%20can%20be%20found%20from%20this%20repo%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Ffreistli%2FModernizeApp%2Ftree%2Fmaster%2FMFC%2FMFCAppWinUI%3C%2FA%3E%3C%2FP%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1130087%22%20slang%3D%22en-US%22%3E%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2223.gif%22%20style%3D%22width%3A%20745px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167347iB1A1AD2E5BF98497%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%2223.gif%22%20alt%3D%2223.gif%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EThis%26nbsp%3Barticle%26nbsp%3Bexplains%26nbsp%3Bhow%26nbsp%3Bto%26nbsp%3Bmodernize%26nbsp%3BMFC%26nbsp%3BMDI%26nbsp%3Bproject%26nbsp%3Bwith%26nbsp%3Bcustom%26nbsp%3BUWP%26nbsp%3BControls%26nbsp%3Bthrough%26nbsp%3BXAML%26nbsp%3BIslands.%26nbsp%3BWith%26nbsp%3Bcustom%26nbsp%3BUWP%26nbsp%3Bcontrols%2C%26nbsp%3Bit%26nbsp%3Ballows%26nbsp%3Bus%26nbsp%3Bto%26nbsp%3Bdefine%26nbsp%3Bcontrol%26nbsp%3Blayout%26nbsp%3Beasily%26nbsp%3Bthrough%26nbsp%3BXAML%26nbsp%3Bpages.%26nbsp%3BNot%26nbsp%3Bonly%26nbsp%3Bputting%26nbsp%3Bstandard%26nbsp%3BUWP%26nbsp%3Bcontrols%26nbsp%3Binto%26nbsp%3Bthe%26nbsp%3Bcustom%26nbsp%3Bcontrol%2C%26nbsp%3Bwe%26nbsp%3Bcan%26nbsp%3Balso%26nbsp%3Bintegrate%26nbsp%3Bother%26nbsp%3Bcustom%26nbsp%3Bcontrols%26nbsp%3Bas%26nbsp%3Bwell%2C%26nbsp%3Bsuch%26nbsp%3Bas%26nbsp%3Blatest%26nbsp%3BWinUI%26nbsp%3Bcontrols.%26nbsp%3BWe%26nbsp%3Bwill%26nbsp%3Buse%26nbsp%3Ba%26nbsp%3Bnew%26nbsp%3BXaml%26nbsp%3BApplication%26nbsp%3Bproject%26nbsp%3Bto%26nbsp%3Bbring%26nbsp%3Bthe%26nbsp%3Bcustom%26nbsp%3BUWP%26nbsp%3Bcontrols%26nbsp%3Binto%26nbsp%3Bour%26nbsp%3BMFC%26nbsp%3Bproject.%26nbsp%3BThis%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fapps%2Fdesktop%2Fmodernize%2Fusing-the-xaml-hosting-api%23host-a-custom-uwp-control%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ehas%26nbsp%3Bmentioned%26nbsp%3Bhow%26nbsp%3Bto%26nbsp%3Buse%26nbsp%3Bthe%26nbsp%3Bnew%26nbsp%3BXAML%26nbsp%3Bapplication%26nbsp%3Bin%26nbsp%3BWin32%26nbsp%3BC%2B%2B%26nbsp%3Bapplication%2C%26nbsp%3Bwe%26nbsp%3Bwill%26nbsp%3Bgive%26nbsp%3Bmore%26nbsp%3Bdetailed%26nbsp%3Bsteps%26nbsp%3Bfor%26nbsp%3BMFC%26nbsp%3Bproject.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1130087%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EC%2B%2B%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMFC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EModernize%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMSIX%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWIN32%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWinUI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EXAML%20Islands%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Host Custom UWP Controls in MFC MDI Project using XAML Islands

This article explains how to modernize MFC MDI project with custom UWP Controls through XAML Islands. With custom UWP controls, it allows us to define control layout easily through XAML pages. Not only putting standard UWP controls into the custom control, we can also integrate other custom controls as well, such as latest WinUI controls. We will use a new Xaml Application project to bring the custom UWP controls into our MFC project. This article has mentioned how to use the new XAML application in Win32 C++ application, we will give more detailed steps for MFC project.

Overall, in our MFC project, we will have two parts to demonstrate this method:

  • MFC MDI Project
  • A companion UWP app project that defines a XamlApplication object.
    In this project, we will define a custom UWP control and export it so that MFC can use the custom UWP control.

Development Environment

  • Visual Studio 2019 (16.3.6)
  • Windows 10 1909 (18363.476)
  • Windows 10 SDK (10.0.18362.1)

Configure MFC Project

  1. Create MFC App in Visual Studio 2019, will name it MFCAPP

    0.png

    Use below configuration to create the MFCAPP project

    1.png

    click Finish Build and Run it, here is its default UI

    2.png
  2. In Solution Explorer, right-click the MFCAPP project node, click Retarget Project, select the 10.0.18362.0 or a later SDK release, and then click OK.

    3.png

    4.png

  3. Install the Microsoft.Windows.CppWinRT NuGet package:

    1. Right-click the project in Solution Explorer and choose Manage NuGet Packages.
    2. Select the Browse tab, search for the Microsoft.Windows.CppWinRT package, and install the latest version of this package.
    5.png

    After install the nuget package, check the MFC project properties, you will notice its C++ version is ISO C++17, which is required by C++/WinRT:

    6.png

    Build this MFCApp, we can see winrt projected files are generated in the “Generated Files” folder:

    7.png
  4. Install the Microsoft.Toolkit.Win32.UI.SDK NuGet package:

    1. In the NuGet Package Manager window, make sure that Include prerelease is selected.
    2. Select the Browse tab, search for the Microsoft.Toolkit.Win32.UI.SDK package, and install version v6.0.0 (or Later) of this package.
    8.png
  5. Install the Microsoft.VCRTForwarders.140 nuget package as well. Running Custom UWP Control in this project will require VC libs.

Configure UWP Project

  1. In Solution Explorer, right-click the solution node and select Add -> New Project.

  2. Add a Blank App (C++/WinRT) project to your solution.

    1.png

    Note: Please make sure this is C++/WinRT template. If cannot find it, you'll want to download and install the latest version of the C++/WinRT Visual Studio Extension (VSIX) from the Visual Studio Marketplace.
  3. Give it a name MyApp, and create it, Make sure the target version and minimum version are both set to Windows 10, version 1903 or later.

  4. Right click the MyApp and open its properties, make sure its C++/WinRT configuration is as below:

    3.png

  5. Change its output type from .EXE to Dynamic Library

    4.png

  6. Save a dummy.exe into the MyApp folder. It doesn’t need to be a real exe, just input “dummy exe file” in notepad, and save it as dummy.exe.

    5.png

    6.png

    Make sure the Content property of dummy.exe is True.

    6.1.png

  7. Now edit Package.appxmanifest, change the Executable attribute to “dummy.exe”

7.png
  1. Right click the MyApp project, select Unload Project

  2. Right click the MyApp (Unloaded) project, select Edit MyApp.vcxproj

  3. Add below properties to the MyApp.vcxproj project file:

<PropertyGroup Label="Globals">
    <WindowsAppContainer>true</WindowsAppContainer>
    <AppxGeneratePriEnabled>true</AppxGeneratePriEnabled>
    <ProjectPriIndexName>App</ProjectPriIndexName>
    <AppxPackage>true</AppxPackage>
  </PropertyGroup>

For example:

8.png
  1. Right click the MyApp (Unloaded) project, select Reload Project.

  2. Right click Mainpage.xml, select Remove. And then click Delete

  3. Copy App.Xaml, App.cpp, App.h, App.idl contents to overwrite current ones:

App.Xaml

<Toolkit:XamlApplication
    x:Class="MyApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    RequestedTheme="Light"
    mc:Ignorable="d">
</Toolkit:XamlApplication>

App.cpp

#include "pch.h"
#include "App.h"

using namespace winrt;
using namespace Windows::UI::Xaml;

namespace winrt::MyApp::implementation
{
    App::App()
    {
        Initialize();

        AddRef();
        m_inner.as<::IUnknown>()->Release();
    }

    App::~App()
    {
        Close();
    }
}

App.h

//
// Declaration of the App class.
//

#pragma once

#include "App.g.h"
#include "App.base.h"

namespace winrt::MyApp::implementation
{
    class App : public AppT2<App>
    {
    public:
        App();
        ~App();
    };
}

namespace winrt::MyApp::factory_implementation
{
    class App : public AppT<App, implementation::App>
    {
    };
}

App.idl

namespace MyApp
{
    [default_interface]
    runtimeclass App: Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication
    {
        App();
    }
}
  1. Create app.base.h in this project, and use below content:

app.base.h

#pragma once

namespace winrt::MyApp::implementation
{
    template <typename D, typename... I>
    struct App_baseWithProvider : public App_base<D, ::winrt::Windows::UI::Xaml::Markup::IXamlMetadataProvider>
    {
        using IXamlType = ::winrt::Windows::UI::Xaml::Markup::IXamlType;

        IXamlType GetXamlType(::winrt::Windows::UI::Xaml::Interop::TypeName const& type)
        {
            return AppProvider()->GetXamlType(type);
        }

        IXamlType GetXamlType(::winrt::hstring const& fullName)
        {
            return AppProvider()->GetXamlType(fullName);
        }

        ::winrt::com_array<::winrt::Windows::UI::Xaml::Markup::XmlnsDefinition> GetXmlnsDefinitions()
        {
            return AppProvider()->GetXmlnsDefinitions();
        }

    private:
        bool _contentLoaded{ false };
        std::shared_ptr<XamlMetaDataProvider> _appProvider;
        std::shared_ptr<XamlMetaDataProvider> AppProvider()
        {
            if (!_appProvider)
            {
                _appProvider = std::make_shared<XamlMetaDataProvider>();
            }
            return _appProvider;
        }
    };

    template <typename D, typename... I>
    using AppT2 = App_baseWithProvider<D, I...>;
}
  1. Install Microsoft.Toolkit.Win32.UI.XamlApplication Nuget package.

  2. If you build MyApp now, it should create MyApp.dll without any error.

Centralize Output, Input and C++/WinRT files in Solution

This step is necessary for our next steps because we need to include winrt header files in different projects properly, and MFCApp also needs to reference MyApp resource files.

  1. Add a new Solution.Props file by right clicking the solution node, and select Add -> New Item:
13.png
  1. Use below content to overwrite the Solution.Props:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</IntDir>
    <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir>
    <GeneratedFilesDir>$(IntDir)Generated Files\</GeneratedFilesDir>
  </PropertyGroup>
</Project>
  1. Click Views -> Other Windows -> Property Manager

    14.png

  2. Right click MFCApp, select Add Existing Property Sheet, add the new solution.props file

    15.png

  3. Repeat the step 4. for MyApp. We can close the Property Manager window now.

  4. Right click the project node MFCApp, select Properties. Set

Output Directory: $(OutDir)

Intermidia Directory: $(IntDir)

12.png

  1. Repeat the step 6 for MyApp.

  2. Right click the Solution node, and choose Project Dependencies, make sure MFCApp depends on MyApp:

    16.png

  3. Rebuild the whole solution, it should work without errors.

Add UWP Custom XAML Control to MyApp

  1. Right click MyApp, select Add -> New Item
  2. Create Blank User Conrol (C++/WinRT), here we call it TreeViewUserControl:
10.png

Integrate Custom XAML Control in MFCApp

  1. Add one app.manifest in your project with below content to register custom control type:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly
    xmlns="urn:schemas-microsoft-com:asm.v1"
    xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
    manifestVersion="1.0">
    <asmv3:file name="MyApp.dll">
        <activatableClass
            name="MyApp.App"
            threadingModel="both"
            xmlns="urn:schemas-microsoft-com:winrt.v1" />
        <activatableClass
            name="MyApp.XamlMetadataProvider"
            threadingModel="both"
            xmlns="urn:schemas-microsoft-com:winrt.v1" />
        <activatableClass
            name="MyApp.TreeViewUserControl"
            threadingModel="both"
            xmlns="urn:schemas-microsoft-com:winrt.v1" />
    </asmv3:file>
</assembly>
  1. Now the project structure is like as below:

    12.png

  2. Right click the Win32 Project MFCApp, select Unload Project

  3. Right click the MFCApp (Unloaded) project, select Edit MFCApp.vcxproj

  4. Remove the three lines from the MFCApp.vcxproj project file:

<ItemGroup>
    <Manifest Include="app.manifest" />
</ItemGroup>

Add below properties to the MFCApp.vcxproj project file before the “<Import Project=”“$(VCTargetsPath).Cpp.targets” />" line:

  <ItemGroup>
    <Manifest Include="app.manifest" />
    <AppxManifest Include="$(SolutionDir)\bin\$(Platform)\$(Configuration)\$(AppProjectName)\AppxManifest.xml" />
  </ItemGroup>
  <PropertyGroup>
    <AppProjectName>MyApp</AppProjectName>
  </PropertyGroup>
  <PropertyGroup>
    <AppIncludeDirectories>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(AppProjectName)\;$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(AppProjectName)\Generated Files\;</AppIncludeDirectories>
  </PropertyGroup>
    <ItemGroup>
    <NativeReferenceFile Include="$(SolutionDir)\bin\$(Platform)\$(Configuration)\$(AppProjectName)\*.xbf">
      <DeploymentContent>true</DeploymentContent>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </NativeReferenceFile>
    <NativeReferenceFile Include="$(SolutionDir)\bin\$(Platform)\$(Configuration)\$(AppProjectName)\*.dll">
      <DeploymentContent>true</DeploymentContent>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </NativeReferenceFile>
    <NativeReferenceFile Include="$(SolutionDir)\bin\$(Platform)\$(Configuration)\$(AppProjectName)\resources.pri">
      <DeploymentContent>true</DeploymentContent>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </NativeReferenceFile>
  </ItemGroup>
  <------Right Here--------->
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  1. Right click the MFCApp (Unloaded) project, select Reload Project.

  2. Right click MFCApp, select Properties, setup $(AppIncludeDirectories) as a part of include file path, this macro has been defined in the above project file:

    17.png

  3. Set “Per Monitor DPI Aware” for DPI Awareness otherwise you may be not able to start this MFCApp when it is “High DPI Aware” and hit configuration error in Manifest: 19.png

  1. Open pch.h, add below code to include necessary winrt header files:

    #pragma push_macro("GetCurrentTime")
    #pragma push_macro("TRY")
    #undef GetCurrentTime
    #undef TRY
    #include <winrt/Windows.Foundation.Collections.h>
    #include <winrt/Windows.system.h>
    #include <winrt/windows.ui.xaml.hosting.h>
    #include <windows.ui.xaml.hosting.desktopwindowxamlsource.h>
    #include <winrt/windows.ui.xaml.controls.h>
    #include <winrt/Windows.ui.xaml.media.h>
    #include <winrt/Windows.UI.Core.h>
    #include <winrt/myapp.h>
    #pragma pop_macro("TRY")
    #pragma pop_macro("GetCurrentTime")

    Regarding the reason of using “GetCurrentTime” and “TRY” macros, please refer to: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/faq

    Using winrt namespaces in MFCAPPView.h and MFCAPP.h

    using namespace winrt;
    using namespace Windows::UI;
    using namespace Windows::UI::Composition;
    using namespace Windows::UI::Xaml::Hosting;
    using namespace Windows::Foundation::Numerics;
    using namespace Windows::UI::Xaml::Controls;
  2. Declare hostApp in MFCApp.h

public:
    winrt::MyApp::App hostApp{ nullptr };
  1. Initalize hostApp right before new CMainFrame in CMFCAppApp::InitInstance() in MFCApp.CPP
    hostApp = winrt::MyApp::App{};
    <---Right Here--->
    // create main MDI Frame window
    CMainFrame* pMainFrame = new CMainFrame;
  1. Declare _desktopWindowXamlSource and our custom control in MFCAppView.h
private:
    winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource _desktopWindowXamlSource{ nullptr };
    winrt::MyApp::TreeViewUserControl _treeViewUserControl{ nullptr };
  1. Initialize _desktopWindowXamlSource and custom control in MFCAppView.cpp
if (_desktopWindowXamlSource == nullptr)
{   
    _desktopWindowXamlSource = DesktopWindowXamlSource{};
    auto interop = _desktopWindowXamlSource.as<IDesktopWindowXamlSourceNative>();
    check_hresult(interop->AttachToWindow(GetSafeHwnd()));

    HWND xamlHostHwnd = NULL;
    check_hresult(interop->get_WindowHandle(&xamlHostHwnd));

    _treeViewUserControl = winrt::MyApp::TreeViewUserControl();
    _desktopWindowXamlSource.Content(_treeViewUserControl);

    RECT windowRect;
        GetWindowRect(&windowRect);
        ::SetWindowPos(xamlHostHwnd, NULL, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_SHOWWINDOW);
}
  1. Clean up resources when the view is disconstructed in MFCAppView.cpp

    CMFCAppView::~CMFCAppView()
    {
        if (_desktopWindowXamlSource != nullptr)
        {
            _desktopWindowXamlSource.Close();
            _desktopWindowXamlSource = nullptr;
        }
    }
  2. Add AdjustLayout function to make XAML content layout properly in MFCAppView.cpp :

```C++
void CMFCAppView::AdjustLayout()
{
    if (_desktopWindowXamlSource != nullptr)
    {
        auto interop = _desktopWindowXamlSource.as<IDesktopWindowXamlSourceNative>();
        HWND xamlHostHwnd = NULL;
        check_hresult(interop->get_WindowHandle(&xamlHostHwnd));

        RECT windowRect;
        GetWindowRect(&windowRect);
        ::SetWindowPos(xamlHostHwnd, NULL, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_SHOWWINDOW);
    }
}
```

Don't forget to declare it in MFCAppView.h:

```C++
public:
    void AdjustLayout();
```
  1. Right click the MFCApp project, select Class Wizard

    9.png

    Add a handler to handle WM_SIZE so that when view size changes we can handle it:

    10.png
  2. Modify the OnSize method handler:

```C++
void CMFCAppView::OnSize(UINT nType, int cx, int cy)
{
    CView::OnSize(nType, cx, cy);
    AdjustLayout();
}
```
  1. Now you can build and run this MFCApp. It should display a button in the central of view window:
21.gif

Using WinUI in UWP Custom Control in MyApp UWP Project

  1. In MyApp, let’s add the Microsoft.UI.Xaml nuget package:
22.png

[!NOTE] It is possible some version of WinUI nuget package doesn’t create Microsoft.UI.Xaml.Controls class registering info into AppxManifest.xml, which is required by MFCApp later. This version used above works well. If you found MFCApp failed to run with “Class is not registered” error, please try this version.

  1. Modify App.Xaml, TreeViewUserControl.Xaml, pch.h and TreeViewUserContro.cpp as below:

    For detailed reasons on modifying these files, can refer to this article

Add the Windows UI (WinUI) Theme Resources to App.Xmal

<Toolkit:XamlApplication
    x:Class="MyApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:Toolkit="using:Microsoft.Toolkit.Win32.UI.XamlHost"
    xmlns:MSMarkup="using:Microsoft.UI.Xaml.Markup"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    RequestedTheme="Light"
    mc:Ignorable="d">
    <Toolkit:XamlApplication.Resources>
        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
    </Toolkit:XamlApplication.Resources>
</Toolkit:XamlApplication>

Add WinUI reference and WinUI TreeView control in TreeViewUserControl.Xaml

<UserControl
    x:Class="MyApp.TreeViewUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Button x:Name="Button" Click="ClickHandler">Click Me</Button>
        <muxc:TreeView x:Name="WinUITreeView">
            <muxc:TreeView.RootNodes>
                <muxc:TreeViewNode Content="Flavors"
                           IsExpanded="True">
                    <muxc:TreeViewNode.Children>
                        <muxc:TreeViewNode Content="Vanilla"/>
                        <muxc:TreeViewNode Content="Strawberry"/>
                        <muxc:TreeViewNode Content="Chocolate"/>
                    </muxc:TreeViewNode.Children>
                </muxc:TreeViewNode>
            </muxc:TreeView.RootNodes>
        </muxc:TreeView>
    </StackPanel>
</UserControl>

Include WinUI winrt header files in pch.h

#include "winrt/Microsoft.UI.Xaml.Controls.h"
#include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h"

TreeViewUserControl.cpp

void TreeViewUserControl::ClickHandler(IInspectable const&, RoutedEventArgs const&)
    {
        Button().Content(box_value(L"Clicked"));
        winrt::Microsoft::UI::Xaml::Controls::TreeViewNode tn = winrt::Microsoft::UI::Xaml::Controls::TreeViewNode{};
        tn.Content(winrt::box_value(L"Clicked"));
        WinUITreeView().RootNodes().First().Current().Children().Append(tn);
    }
  1. Build and run MFCApp, if steps have been taken exactly as above, it will show as below:
23.gif

Wrap Up

This article gives detailed steps on how to leverage XamplApplication to host custom XAML control in document view of traditional MFC Mulitple Document Interface project, and the important thing is you can use WinUI to modernize the MFC application now. The whole smaple solution can be found from this repo: https://github.com/freistli/ModernizeApp/tree/master/MFC/MFCAppWinUI