0

I am trying to use new WinUI toolkit TreeView/TeachingTip/... control to my UWP Application. I have added the references Microsoft.UI.Xaml from Nudget packages.

<Page 
    x:Class="UWPInVS2019.Login"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:UWPInVS2019"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:WinCon="using:Microsoft.UI.Xaml.Controls"
    mc:Ignorable="d" 
>
<Grid>
<Button />
<WinCon:TeachingTip/>
</Grid>

I am getting the below error message enter image description here

1
  • Does the following works? Commented Apr 29, 2020 at 13:39

1 Answer 1

2

The problem is that you miss adding XamlControlsResources to the UWP project App.xaml file. Please add the following xaml code into App.xaml file.

<Application>
    <Application.Resources>
        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
    </Application.Resources>
</Application>

For more detail, please refer WinUI official tutorial.

Sign up to request clarification or add additional context in comments.

4 Comments

I have added the XamlControlsResources to App.Xaml .Its works Fine now.
If I add the XamlControlResources in app.xaml the default styles of controls(Button ) of UWP application get updated to WinUI controls styles(i.e rounded corner). Without adding the XamlControlResources to App.Xaml Is there any way to add extra controls(teaching tip/treeView) of WinUI to UWP application. My aim is to use the UWP controls and use the extra controls that where used in WinUI.
TreeView available in 1809, if we edit the min target version to 1809, you could use TreeView directly.
@NicoZhu-MSFT I have similar issue posted here if you have some time for a suggestion/comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.