2013-07-02 127 views
0

我正在使用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 LIST:

 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

如何解决这些错误?你能回答我的问题吗?

回答

3

右键单击解决方案资源管理器中的项目文件。选择Add Reference,进入Assemblies选项卡并找到System.Windows。添加参考和瞧。