2016-03-07 47 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; 
    } 
相關問題