简体   繁体   中英

DevExpress 11.1 Grid Control missing reference

I was just downloaded DevExpress Universal Trial to try it out on VB.Net WPF project.

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.

<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. 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.

Cheers !

The problem is that you're using the dxg XML namespace, but you've never defined it in the XAML. See all those xmlns definitions in the Window tag? You need to add one for dxg as well. 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.

Add the following line near the other xmlns tags in the XAML for the file you're working in.

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

XAML Namespaces

Additionally, make sure that the DevExpress DLLs have been referenced in your project. Even if you correct the namespace issue, if the DLLs are not referenced by your project, then you will continue to have issue. 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). You may have to look in your own documentation for more accurate information:

Required DLLs for DevExpress WPF Deployment

How to add references to DLLs in Visual Studio 2010

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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