Controls are not supported in a Windows Presentation Foundation (WPF) project

I am trying to use user control

and I have tried several different solutions, but I have not been able to fix this problem:

In my main window, I wrote the code as shown below:

   <Window x:Class="WPF_Work_Timer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:WPF_Work_Timer"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TabControl>
            ...
            <TabItem Header="This Week">
                <controls.WeekView></controls.WeekView> 
                <!-- ^Controls is not supported in WPF Error is here. -->
            </TabItem>
            ...
        </TabControl>
    </Grid>
</Window>

      

I wrote the code as shown below for user control

:

 <UserControl x:Class="WPF_Work_Timer.WeekView"
             x:Name="WeekViewControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        ...
    </Grid>
</UserControl>

      

I was looking for a solution to this problem and I'm sure I am missing something very simple.

+3


source to share


1 answer


The problem is that you are using a period .

instead of a colon :

. Try the following:



<controls:WeekView></controls:WeekView> 

      

+5


source







All Articles