当我尝试加载视图(即MainWindow.xaml)时,发生未处理的异常。仅当项目代码在后面运行时,才会发生这种情况。否则,它将正常工作。请帮忙。以下是异常详细信息。
此处的屏幕截图:Screenshot
System.ArgumentNullException
值不能为空。
参数名称:remoteValues
Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalNotifyingEnumerable 2..ctor(IRemoteNotifyingEnumerable
1 remoteValues,Func`2转换器)
在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerView.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerView.get_RelatedDocumentPaths()
在Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
我尝试单击“单击此处以禁用项目代码并重新加载设计器”。当我这样做时,它起作用。但是,当我启用项目代码时,也会出现相同的异常。
Mainwindow.xaml:
<Window x:Class="QCFilterSaver.View.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{DynamicResource MetroStyle}"
xmlns:view="clr-namespace:QCFilterSaver.View"
mc:Ignorable="d"
Title="QC Filter Saver" Height="520" Width="1200" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/ExpressionDark.xaml"/>
<ResourceDictionary Source="/Themes/MetroDark.MSControls.Core.Implicit.xaml"/>
<ResourceDictionary Source="/Themes/MetroDark.MSControls.Toolkit.Implicit.xaml"/>
<ResourceDictionary Source="/Controls\DataGridStyleDictionary.xaml"/>
<ResourceDictionary Source="/MainDataTemplates.xaml"/>
<ResourceDictionary Source="/Controls/Styles/LoadingArcsRing.xaml"/>
<ResourceDictionary Source="/Controls/Styles/LoadingThreeDots.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<view:FSView x:Name="FSView" HorizontalContentAlignment="Stretch"/>
</Grid>
</Window>
FSView.xaml:
<UserControl x:Class="QCFilterSaver.View.FSView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QCFilterSaver.ViewModels"
mc:Ignorable="d"
d:DesignHeight="520" d:DesignWidth="1200">
<UserControl.DataContext>
<local:FSViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#a70711"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<!--my properties and bindings here-->
</Grid>
</UserControl>
设计人员应该自动加载,没有例外。