简体   繁体   English

Windows Presentation Foundation(WPF)项目不支持控件

[英]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.

相关问题 Windows Presentation Foundation(WPF)项目不支持AppCommand - AppCommand are not supported in a Windows Presentation Foundation (WPF) project Windows Presentation Foundation(WPF)项目不支持MyCanvas - MyCanvas is not supported in a Windows Presentation Foundation (WPF) project Windows Presentation Foundation (WPF) 项目不支持网格 - Grid is not supported in a Windows Presentation Foundation (WPF) project 为什么我会在xaml中的Windows Presentation Foundation(WPF)项目错误中获得“BoolToRowHeightConverter”? - Why would I get a "BoolToRowHeightConverter is not supported in a Windows Presentation Foundation(WPF) project error in xaml? 程序集中的类型是使用旧版本的blend sdk构建的,并且在windows presentation foundation 4项目中不受支持 - the type from assembly is built with an older version of blend sdk and is not supported in a windows presentation foundation 4 project 如何使用 get, set in Windows Presentation Foundation (WPF) - How to use get, set in Windows Presentation Foundation (WPF) 在Windows演示基础(WPF)应用程序中实现安全登录机制 - Implement a secure login mechansim in Windows presentation foundation (WPF) application 在 Windows Presentation Foundation WPF C# 中禁用自动鼠标悬停 - Disable automatic MouseHover in Windows Presentation Foundation WPF C# Microsoft Windows Presentation Foundation错误 - Microsoft windows presentation foundation error 在Windows Presentation Foundation中使用MVC代替MVVM - Use MVC instead of MVVM in Windows Presentation Foundation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM