[英]Controls is not Supported in the Windows Presentation Foundation (WPF) Project
I am trying to use a user control
and I have tried a few different solutions but, I have not been able to fix this issue: 我试图使用
user control
,我尝试了一些不同的解决方案,但是,我无法解决这个问题:
In my main window, I have written code like 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 have written code like below for the User Control
: 我为
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 have searched for a solution for this issue and I am sure that I am missing something very simple. 我已经为这个问题寻找了解决方案,我确信我错过了很简单的东西。
The problem is you're using a period .
问题是你正在使用一段时间
.
instead of a colon :
. 而不是冒号
:
。 Try this: 试试这个:
<controls:WeekView></controls:WeekView>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.