问题描述
我正在使用Visual Studio 2015开发UWP应用,而我想做的一件事是在设计时使用一些示例数据.
I'm developing a UWP app with Visual Studio 2015, and one of the things I want to do use some sample data at design time.
现在,我添加了一个XAML文件,将构建操作设置为DesignDataWithDesignTimeCrateableTypes
Now, I've added a XAML file, set the build action as DesignDataWithDesignTimeCrateableTypes
我的XAML确实很简单:
My XAML is really straight forward here:
<local:Freead
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyNamespace.Uwp.Windows.ViewModels"
xmlns:ad="clr-namespace:MyNamespace.Classifieds;assembly=LocalAngle.Uwp"
ItemName="Java books"
Description="Free to anyone that wants them. A little out of date, but would make a handy doorstop."
ContactDetails="01632 960000"
Latitude="52.22" Longitude="1.95">
</local:Freead>
但是,智能感知给了我淡蓝色的波浪线和以下内容的工具提示:
However, the intellisense is giving me pale blue wavy line and a tooltip for that of:
从历史上看,我能够通过启动另一个Visual Studio实例,进行附加和设置以打破所有异常的方式来调试XAML设计问题,但是这里似乎没有抛出异常,因此我该如何调试为什么为什么不能创建该类型的实例? (鉴于明显的问题已经过检查,即有一个无参数的构造函数,并且解决方案确实可以构建)
Historically, I've been able to debug the XAML design issues by firing up another instance of Visual Studio, attaching, and setting to break on all exceptions, but no exceptions appear to be thrown here, so how can I debug why it cannot create an instance of the type? (Given the obvious has already been checked, i.e. there is a parameterless constructor, and solution does build)
推荐答案
我遇到了XAML Designer错误,并尝试了旧的Visual Studio 2015之前的方法:
I was having XAML Designer errors and tried the old pre-Visual Studio 2015 approach:
- 关闭所有打开的XAML设计器窗口
- 启动另一个VS 2015实例
- 附加到"XDesProc.exe"过程(对我来说只有一个)
- 在原始VS实例中的设计器中打开有问题的XMAL页面
我的错误是对象未初始化",但是很快找到了潜在的问题.解决它需要更多的努力!
My error was "Object not initialized", but it was quite quick to find the underlying problem. Fixing it was a bit more effort!
这篇关于如何调试XAML设计器问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!