Search code examples
c#uwpcontrolsuniformgrid

Unknown type 'UniformGrid' in XML namespace 'using:Microsoft.Toolkit.Uwp.UI.Controls'


I'm trying to use a Uniform Grid to dynamically create a grid. However, the type UniformGrid doesn't exist in Microsoft.Toolkit.Uwp.UI.Controls. I've updated my NuGet for UWP and it still doesn't seem to work. Here's my code:

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ConwaysGameofLife"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<controls:UniformGrid>
    <Border Background="AliceBlue" Grid.Row="1" Grid.Column="1">
        <TextBlock Text="1"/>
    </Border>
    <Border Background="Cornsilk">
        <TextBlock Text="2"/>
    </Border>
    <Border Background="DarkSalmon">
        <TextBlock Text="3"/>
    </Border>
    <Border Background="Gainsboro">
        <TextBlock Text="4"/>
    </Border>
    <Border Background="LightBlue">
        <TextBlock Text="5"/>
    </Border>
    <Border Background="MediumAquamarine">
        <TextBlock Text="6"/>
    </Border>
    <Border Background="MistyRose">
        <TextBlock Text="7"/>
    </Border>
 </controls:UniformGrid>
</Page>

Thanks in advance.


Solution

  • Welp, seems I'm just blind. I forgot to specifically install the Microsoft.Toolkit.Uwp.UI.Controls NuGet. I only had Microsoft.Toolkit.Uwp.UI installed.

    Installing that and rebuilding fixed the issue.