XAML设计师拒绝接受用户控制(XAML designer refuses to accept user control)

编程入门 行业动态 更新时间:2024-10-26 14:40:00
XAML设计师拒绝接受用户控制(XAML designer refuses to accept user control)

XAML设计者要么抱怨控件不在名称空间中,要么控件可以放在UIElement集合中。

该控件的定义如下:

namespace OdinSyncManager.Controls { public partial class ServiceListItem: UserControl { public ServiceListItem() { InitializeComponent(); } } }

XAML具有以下代码(我只将文件头部包含在控件中):

<... xmlns:Control="clr-namespace:OdinSyncManager.Controls" mc:Ignorable="d" Title="MainWindow"> <DockPanel LastChildFill="True" Margin="0,0,14,14" Background="#FFFF6D6D"> <Control:ServiceListItem/> <...>

我不确定缺少什么?

The XAML designer either complains that the control isn't in the namespace or that the control can be placed in a UIElement Collection.

The control is defined as such:

namespace OdinSyncManager.Controls { public partial class ServiceListItem: UserControl { public ServiceListItem() { InitializeComponent(); } } }

The XAML has the following code (I've only included the head of the file up to the control):

<... xmlns:Control="clr-namespace:OdinSyncManager.Controls" mc:Ignorable="d" Title="MainWindow"> <DockPanel LastChildFill="True" Margin="0,0,14,14" Background="#FFFF6D6D"> <Control:ServiceListItem/> <...>

I'm not sure what's missing?

最满意答案

确保你添加了一个WPF UserControl到你的项目中,而不是一个winform

Make sure you added a WPF UserControl to your project, not a winform

更多推荐

本文发布于:2023-08-07 12:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464194.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设计师   用户   designer   XAML   user

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!