2

I set the datasource for a WPF dxg:GridControl to that of a hard coded list.

        gridControl1.ItemsSource = new List<Entity> { new Entity() { Name = "1" }, new Entity() { Name = "2" }, new Entity() { Name = "3" } };

I have to specify each column in the XAML:

        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="Name" Name="gridColumn1" />
            <dxg:GridColumn FieldName="Column2" Name="gridColumn2" />
        </dxg:GridControl.Columns>

How can I get the columns to autogenerate instead of specifying XAML?

I tried removing the columns. That displayed nothing. The data actually comes from a WCF service at runtime, so the "Populate Columns" button in design mode is probably not going to work either.

4

1 回答 1

1

在黑暗中有点刺,但WPF中的其他网格通常有这样的东西......

<dxg:GridControl AutoPopulateColumns ="True">

(编辑以获取实际属性名称)

于 2012-06-14T19:53:08.083 回答