我有这样的结构:

LightWindow.cs
namespace ScreenToGif.Controls.LightWindow
{
public class LightWindow : Window
{
static LightWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(LightWindow), new FrameworkPropertyMetadata(typeof(LightWindow)));
}
//...
}
}Recorder.xaml
<lightWindow:LightWindow x:Class="ScreenToGif.Windows.Recorder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lightWindow="clr-namespace:ScreenToGif.Controls.LightWindow"
</lightWindow:LightWindow>Generic.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lightWindow="clr-namespace:ScreenToGif.Controls.LightWindow">
<!-- Window style -->
<Style TargetType="{x:Type lightWindow:LightWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type lightWindow:LightWindow}">
<!-- closing tags omitted -->问题:
Recorder窗口打开不可见。在“我的测试项目”(在另一个项目中使用自定义窗口的dll )中,该窗口将正确显示。
如果我删除了Recorder调用(不是我想要的),那么唯一显示出来的就是OverrideMetadata窗口的内部网格。
发布于 2014-11-22 04:11:29
如何工作:

将Themes资源移动到项目的根文件夹。
https://stackoverflow.com/questions/27073963
复制相似问题