C# 无法创建子窗口

C# 无法创建子窗口,c#,wpf,visual-studio-2010,xaml,C#,Wpf,Visual Studio 2010,Xaml,我正在尝试在WPF中创建子窗口。单击按钮时,此子窗口应打开 我使用的是通用代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System

我正在尝试在WPF中创建子窗口。单击按钮时,此子窗口应打开

我使用的是通用代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

private void Click_setupClass(object sender, RoutedEventArgs e)
{
    ChildWindow child = new ChildWindow();
}
由于某些原因,无法初始化Childwindow。如果缺少程序集引用,则会提示找不到Childwindow


是否可以通过
System.Windows.Controls访问childWindow。我做错了什么?

据我所知,ChildWindow只为Silverlight制作。您应该在WPF中使用窗口类。只需调用
window.ShowDialog()
即可显示模式窗口