我正在使用 Devexpress。通过点击此链接(http://www.devexpress.com/Support/Center/Example/Details/E3863),我在下面编写了此代码。它产生了我在下面定义的两个错误。当我输入程序集引用时,它会生成一个错误,即
Warning 7 Unknown build error, 'Cannot resolve dependency to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' LINQServer
<Window x:Class="LINQServer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:dxsm="clr-namespace:DevExpress.Xpf.Core.ServerMode;assembly=DevExpress.Xpf.Core.v13.1"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:local="clr-namespace:LINQServer"
xmlns:crud="clr-namespace:LINQServer;assembly=CRUDBehavior"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<DataTemplate x:Key="EditRecordTemplate">
<StackPanel Margin="8" MinWidth="200">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="ID:" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Margin="0,0,6,4" />
<dxe:TextEdit x:Name="txtID" Grid.Row="0" Grid.Column="1" EditValue="{Binding Path=Id, Mode=TwoWay}" Margin="0,0,0,4" />
<TextBlock Text="Name:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Margin="0,0,6,4" />
<dxe:TextEdit x:Name="txtCompany" Grid.Row="1" Grid.Column="1" EditValue="{Binding Path=Name, Mode=TwoWay}" Margin="0,0,0,4" />
</Grid>
</StackPanel>
</DataTemplate>
<local:newsEntites x:Key="newsEntites" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<dxg:GridControl x:Name="grid" SelectionMode="Row">
<i:Interaction.Behaviors>
<crud:EntityServerModeCRUDBehavior x:Name="helper"
NewRowForm="{StaticResource ResourceKey=EditRecordTemplate}"
EditRowForm="{StaticResource ResourceKey=EditRecordTemplate}"
EntityType="{x:Type local:Item}"
ObjectContext="{StaticResource ResourceKey=newsntites}"
AllowKeyDownActions="True">
<crud:EntityServerModeCRUDBehavior.DataSource>
<dxsm:EntityServerModeDataSource KeyExpression="Id" QueryableSource="{Binding Items, Source={StaticResource DatabaseEntites}}" />
</crud:EntityServerModeCRUDBehavior.DataSource>
</crud:EntityServerModeCRUDBehavior>
</i:Interaction.Behaviors>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings AllowNullInput="False" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn FieldName="Name">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings AllowNullInput="False" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView Name="view" AutoWidth="True" NavigationStyle="Row" />
</dxg:GridControl.View>
</dxg:GridControl>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Height="22" Width="60" Command="{Binding Path=NewRowCommand, ElementName=helper}">Add</Button>
<Button Height="22" Width="60" Command="{Binding Path=RemoveRowCommand, ElementName=helper}" Margin="6,0,6,0">Remove</Button>
<Button Height="22" Width="60" Command="{Binding Path=EditRowCommand, ElementName=helper}">Edit</Button>
</StackPanel>
</Grid>
</Window>
错误列表:
Error 1 The tag 'Interaction.Behaviors' does not exist in XML namespace 'http://schemas.microsoft.com/expression/2010/interactivity'. Line 39 Position 14. C:\Documents\Visual Studio 2010\Projects\LINQServer\LINQServer\MainWindow.xaml 39 14 LINQServer
Error 2 The type or namespace name 'Interactivity' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) C:Documents\Visual Studio 2010\Projects\LINQServer\LINQServer\EntityServerModeCRUDBehavior.cs 4 22 LINQServer
Error 6 The attachable property 'DataSource' was not found in type 'EntityServerModeCRUDBehavior'. C:\Users\must\Documents\Visual Studio 2010\Projects\LINQServer\LINQServer\MainWindow.xaml 46 22 LINQServer
错误 5 找不到类型“crud:EntityServerModeCRUDBehavior”。确认您没有丢失程序集引用并且所有引用的程序集都已构建。C:\Users\must\Documents\Visual Studio 2010\Projects\LINQServer\LINQServer\MainWindow.xaml 40 18 LINQServer
我该如何解决这些错误?你能回答我的问题吗?