更改主题会导致WPF工具包崩溃 [英] Changing theme causes wpf toolkit to crash

查看:51
本文介绍了更改主题会导致WPF工具包崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过每次都删除主题的顶级资源字典并添加新主题来动态更改主题.
作为参考,我还添加了wpf Toolkit以利用可视状态管理器.

我将举一个例子:
1)我启动我的应用程序,我加载了初始主题,一切正常.
2)我进入了我的应用程序设置,更改主题,然后单击我的按钮.
3)在删除当前主题的资源字典之后,在添加新主题之前,视觉状态管理器(在情节提要的StartNewThenStopOld函数上)崩溃.
它抱怨找不到某个控件(网格)上的视觉效果.我认为这是崩溃的,因为当我单击应用"按钮时,它变为焦点状态(通过设置动画不透明度),然后删除了主题的资源字典.有什么办法解决吗?

谢谢

I am trying to dynamically change themes, by simply removing the top level resource dictionary of my theme each time and adding the new one.
For reference, I have also added wpf Toolkit to take advantage of visual state manager.

I will give an example of what happens:
1) I start my app, i load my initial theme, all is OK.
2) I go to my app settings, change the theme and click apply on my button.
3) I get a crash on visual state manager (on the StartNewThenStopOld function for storyboards) right after I remove my current theme's resource dictionary and before adding the new one.
It complains it cannot find my focus visual on some control (a grid). I assume this is crashing because when i click on my apply button, it changes to the focus state (by animating opacity) and then i am removing the theme's resource dictionary. Is there any way around that? Maybe tell the corresponding thread to wait until the new dictionary has been added and parsed?

Thank you

推荐答案

您好,

请查看此线程.我在那里发布了一些链接可能对您有帮助...
Hi immuner,

please take a look at this thread . I posted a couple of links there that might help ...


这篇关于更改主题会导致WPF工具包崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆