canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
994 stars 143 forks source link

怎么使用全局样式? #137

Closed zqstdy closed 4 years ago

zqstdy commented 4 years ago
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:xx.Style">
    <Style TargetType="Window">
        <Setter Property="Background" Value="#ccc"/>
    </Style>
</ResourceDictionary>

不设置key默认会应用到所有窗口 现在使用了stylet后没有效果了

canton7 commented 4 years ago

Google translate says:

How to use global styles

Do not set the key will be applied to all windows by default Now no effect after using stylet

Have you seen this doc?

If that doesn't help, I really need to see some code which reproduces your issue.

zqstdy commented 4 years ago

这个看过,我也加了字典的资源引用,在编辑模式下显示也正常,就是运行起来没效果了

------------------ 原始邮件 ------------------ 发件人: "Antony Male"<notifications@github.com>; 发送时间: 2020年7月3日(星期五) 下午5:04 收件人: "canton7/Stylet"<Stylet@noreply.github.com>; 抄送: "鱼"<zqstdy@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [canton7/Stylet] 怎么使用全局样式? (#137)

谷歌翻译说:

如何使用整体风格

不设置键默认情况下将应用于所有窗口 现在使用stylet后无效

你看过这个文件吗?

— 您收到此消息是因为您创建了线程。 直接回复此电子邮件,在GitHub上查看,或取消订阅。

canton7 commented 4 years ago

Google translate says:

I have seen this, and I have added the resource reference of the dictionary, and the display is normal in edit mode, but it has no effect when it runs.

I'm afraid I need to see some more code, then. Can you post a project which reproduces your problem?

zqstdy commented 4 years ago

在VS 调试模式可以看到背景颜色,运行之后背景色没了。

下面是测试项目

zqstdy commented 4 years ago

Test.zip https://github.com/zqstdy/Test

canton7 commented 4 years ago

I don't know why this is happening, but the same thing happens in a WPF project without Stylet, so I don't think it's anything to do with Stylet.

Test.zip

zqstdy commented 4 years ago

net core bug……

canton7 commented 4 years ago

I saw the same thing .NET Framework

zqstdy commented 4 years ago

好奇怪,记得以前就这么写的……是我记错了吗?

canton7 commented 4 years ago

Google translate says:

It's so strange, I remember writing this before... Am I remembering it wrong?

I'm not sure I'm afraid - I don't think I've ever tried to do this before now.