简体   繁体   English

在设计器中所做的更改不可见

[英]Changes made in designer not visible

I have a really stupid problem that I just don't understand : I have a WPF application project, and no matter what I do, the changes I do in the designer are not visible when I run the application ! 我有一个我根本不理解的非常愚蠢的问题:我有一个WPF应用程序项目,无论我做什么,当我运行该应用程序时,我在设计器中所做的更改都不可见! I have been working on this project for weeks and all over sudden it's not working anymore. 我已经在这个项目上工作了几个星期,突然之间,它不再工作了。

However, when I change something in the code (MainWindow.xaml.cs for instance) it works. 但是,当我更改代码中的某些内容(例如MainWindow.xaml.cs)时,它可以工作。 I tried showing a messagebox and it showed up when i started the application. 我尝试显示一个消息框,并在启动该应用程序时显示它。

It's probably really silly, but I can't figure this out ! 这可能真的很傻,但是我无法弄清楚!

Any ideas what might be causing this ? 任何想法可能是什么原因造成的?

EDIT : 编辑:

If I add this code : 如果我添加此代码:

System.Windows.Forms.MessageBox.Show("test");

to the MainWindow constructor the MessageBox appears : 到MainWindow构造函数,出现MessageBox:

在此处输入图片说明

but if I try to just change the color of a button in designer : 但是如果我尝试仅更改设计器中按钮的颜色:

在此处输入图片说明

the button doesn't change at runtime : 该按钮在运行时不会更改:

在此处输入图片说明

Had encountered the same issue before. 之前遇到过同样的问题。 Just closed but save your solution and try re-openning it. 刚刚关闭,但保存您的解决方案,然后尝试重新打开它。 I also restarted my computer just to make sure everything is refreshed. 我还重新启动了计算机,以确保一切都刷新了。 :-) For some reason, it helped. :-)由于某种原因,它有所帮助。

Moved from comments -- 从评论移至-

is your VS setup correct ? 您的VS设置正确吗? do you build all your files every time ? 每次都生成所有文件吗?

try clean and re - build, 尝试清洁并重建,

looks like either your project isn't building or VS is not detecting the file changed 看起来您的项目未构建或VS未检测到文件更改

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 XAML Designer中所做的更改仅在重建后才显示在应用程序中 - Changes made in XAML Designer showing in application only after Rebuild 无论如何,如果我通过C#中的表单设计器编辑表单,禁止删除我在Form1.Designer.cs中所做的更改? - Anyway to forbid deleting my changes made in Form1.Designer.cs if i edit form via Form Designer in C#? FluentribbonTabItem 在设计器中不可见? - Fluent ribbonTabItem not visible in designer? UserControl作为界面,但在Designer中可见 - UserControl as an interface, but visible in the Designer 窗口样式在设计器中不可见 - Window style not visible in designer 无法设置WPF TabControl的TabItem的样式,更改仅在VS Designer中可见 - Cannot style WPF TabControl's TabItem, changes are visible only in VS Designer BackgroundWorker是否保证对主线程可见在后台线程上进行的内存更改? - Does BackgroundWorker guarantee that memory changes made on the background thread become visible to the main thread? WPF 文本框在设计器中可见但在应用程序中不可见 - WPF Textbox visible in Designer but not application 设计人员在SDK中进行的调用事件-c# - calling event made by designer in SDK - c# 在 Winforms 中,每当我编辑表单时,我都会丢失对 Designer.cs 所做的其他更改,但我无法弄清楚如何正常添加“调整大小事件” - In Winforms, whenever I edit the form I lose other changes I've made to Designer.cs, but I can't figure out how to add a "Resize Event" normally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM