简体   繁体   English

DevExpress 11.1 Grid Control缺少参考

[英]DevExpress 11.1 Grid Control missing reference

I was just downloaded DevExpress Universal Trial to try it out on VB.Net WPF project. 我刚刚下载了DevExpress Universal Trial,可以在VB.Net WPF项目中试用。

My problem is I can't use Grid Control and Tree List Control which I needed. 我的问题是我无法使用所需的网格控件和树形列表控件。

The first time I added one of them an error pop-up appear 我第一次添加其中一个时,出现错误弹出窗口

Object Reference is not set to an instance of an object 对象引用未设置为对象的实例

And then I tried to add straight to the xaml, and an error occured. 然后,我尝试直接添加到xaml中,并发生了错误。

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <dxg:GridControl Name="gridControl1" DataSource="{StaticResource list}">
        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="Name" />
            <dxg:GridColumn FieldName="AreaKM2" />
            <dxg:GridColumn FieldName="Population" />
        </dxg:GridControl.Columns>
        <dxg:GridControl.View>
            <dxg:GridColumnView NavigationStyle="CellNavigation" />
        </dxg:GridControl.View>
    </dxg:GridControl>
</Grid>

The error says : 错误说:

Error 1 The type 'dxg:GridControl' was not found. 错误1 找不到类型dxg:GridControl。 Verify that you are not missing an assembly reference and that all referenced assemblies have been built. 验证您没有丢失程序集引用,并且所有引用的程序集均已构建。

I'm nowhere near an intermediate user to Visual Studio, so I really hope someone here can help. 我离Visual Studio的中级用户不远,所以我真的希望这里有人可以提供帮助。

Cheers ! 干杯!

The problem is that you're using the dxg XML namespace, but you've never defined it in the XAML. 问题是您使用的是dxg XML名称空间,但从未在XAML中定义它。 See all those xmlns definitions in the Window tag? 查看Window标记中的所有那些xmlns定义吗? You need to add one for dxg as well. 您还需要为dxg添加一个。 I'm not exactly sure which one is for your particular version of control. 我不确定要使用哪个版本的控件。 I found this in the DevExpress documentation, but the documentation is for DX 12.2, so it may not work perfectly. 我在DevExpress文档中找到了此文档,但是该文档适用于DX 12.2,因此它可能无法完美运行。

Add the following line near the other xmlns tags in the XAML for the file you're working in. 在XAML中您正在使用的文件的其他xmlns标记附近添加以下行。

xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"

That should resolve the issue you're having. 那应该可以解决您遇到的问题。 Look at the links below for more help. 请查看下面的链接以获取更多帮助。

DXGrid DXGrid

XAML Namespaces XAML命名空间

Additionally, make sure that the DevExpress DLLs have been referenced in your project. 此外,请确保在您的项目中引用了DevExpress DLL。 Even if you correct the namespace issue, if the DLLs are not referenced by your project, then you will continue to have issue. 即使您纠正了名称空间问题,如果您的项目未引用DLL,那么您仍然会遇到问题。 See the following tutorial for how to do that (basically anywhere it says 12.2 in the DX guide, just think 11.1 and do the same thing). 有关如何执行此操作的信息,请参见以下教程(基本上在DX指南中显示12.2的任何地方,只要考虑11.1并执行相同的操作即可)。 You may have to look in your own documentation for more accurate information: 您可能需要查看自己的文档以获取更准确的信息:

Required DLLs for DevExpress WPF Deployment DevExpress WPF部署所需的DLL

How to add references to DLLs in Visual Studio 2010 如何在Visual Studio 2010中添加对DLL的引用

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM