2016-03-07 29 views
1

我无法将用户控件添加为MainWindow.xaml无法添加我的自定义用户控件在主窗口WPF

这是我的解决方案资源管理器:(指针显示我的用户控制)

Solution Explorer

这是我的用户控制头部的XAML文件

<UserControl x:Class="SIManager.ucAddDevices" 
     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" 
     xmlns:local="clr-namespace:SIManager" 
     mc:Ignorable="d" 
     d:DesignHeight="500" d:DesignWidth="500" FlowDirection="RightToLeft" FontFamily="B Nazanin"> 

这是MainWindows头的XAML

<Window x:Class="SIManager.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:local="clr-namespace:SIManager" 
    mc:Ignorable="d" 
    Title="MainWindow" Height="600" Width="800"> 

现在我不能将我的用户控件添加到标签项目...为什么?

在下图中我的用户控件名称不会出现... !!!!

enter image description here

我怎么可以在我的用户控件添加到选项卡项目????

+0

您在创建用户控件后重建了吗? –

+0

是的,你应该尝试清理解决方案,然后重建它,有时智能感知不会识别控件之前构建 –

+0

我清理和重建解决方案,但不会工作.... – abbas

回答

1

我的用户控制构造得到PARAMS和不会出现在XAML ...

我从用户控件的构造去除PARAMS和重建的解决方案和工作...

抱歉,这是我的错......

感谢

public ucAddDevices(MainWin win) 
    { 
     InitializeComponent(); 
     mainwin = win; 
    } 

要:

public ucAddDevices() 
    { 
     InitializeComponent(); 
     //mainwin = win; 
    } 
相关问题