wpf UserControl 问题

xzjxylophone 2010-08-13 11:50:14
为什么我的 UserControl 一直显示是 加载时出现问题了

UserControl:

<UserControl x:Class="MyTest.UC_CloseMin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="30" Width="75">
<Grid>
<Border CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" BorderBrush="#FFFEFEFE">
<Grid>
<Label Name="lbl_Close" Style="{StaticResource CMLabel}" Margin="0,0,0,0" >
<Label.Background>
<ImageBrush ImageSource="/MyTest;component/Images/Close.png" />
</Label.Background>
</Label>
<Label Name="lbl_Min" Style="{StaticResource CMLabel}" Margin="0,0,40,0" >
<Label.Background>
<ImageBrush ImageSource="/MyTest;component/Images/Min.png" />
</Label.Background>
</Label>
</Grid>
</Border>
</Grid>
</UserControl>




引用界面的调用:

<Window x:Class="MyTest.W_Register"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="W_Register" Height="300" Width="300"
xmlns:local="clr-namespace:MyTest">
<Window.Background>
<ImageBrush ImageSource="/MyTest;component/Images/MainRegister.png" />
</Window.Background>
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/MyTest;component/Images/MainRegister.png" />
</Grid.Background>
<!--这里一直有个红色的波浪线-->
<local:UC_CloseMin></local:UC_CloseMin>
<Button Height="20" Width="40">OK</Button>
</Grid>
</Window>


并且我重新加载该设计界面的时候, 总是提示我未能找到类型: local:UC_CloseMin

注: 这个2个xaml 对应的namespace都是一样的: MyTest
如果我把UserControl那个namespace更改成MyTest.UC 也不行的

这个 问题该怎么解决啊, 让UserControl能正常的显示啊
...全文
151 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jv9 2010-08-14
  • 打赏
  • 举报
回复
提示未找到自定义控件,是因为命名控件引用失败造成的。

检查一下自定义控件,编译成功后,使用 xmlns:local="智能检测控件类命名控件。我想应该是“MyTest.UC_CloseMin”,然后再调用即可。
xzjxylophone 2010-08-13
  • 打赏
  • 举报
回复
谁能 帮帮 啊。。

8,757

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧