首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WPF自定义窗口不可见

WPF自定义窗口不可见
EN

Stack Overflow用户
提问于 2014-11-22 04:11:29
回答 1查看 337关注 0票数 0

我有这样的结构:

LightWindow.cs

代码语言:javascript
复制
namespace ScreenToGif.Controls.LightWindow
{
    public class LightWindow : Window
    {
        static LightWindow()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(LightWindow), new FrameworkPropertyMetadata(typeof(LightWindow)));
        }
     //...
    }
 }

Recorder.xaml

代码语言:javascript
复制
<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

代码语言:javascript
复制
<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窗口的内部网格。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-22 04:11:29

如何工作:

Themes资源移动到项目的根文件夹。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27073963

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档