1

这是我正在尝试做的......请告知这是否可能以及如何实现?

<dxg:GridColumn x:Name="FeatureAverage"  FieldName="Datas[0].FeatureAverage" Width="75" Header="Avg" />

如果我将 List Datas 属性更改为单个值(不是集合),则以下内容可以正常工作。

<dxg:GridColumn x:Name="FeatureAverage"  FieldName="Data.FeatureAverage" Width="75" Header="Avg" />

编辑: 这是一个 DevExpress DXGrid 控件容器和示例类...

整个网格都在这里...

<dxg:GridControl x:Name="gridControl1"  ItemsSource="{Binding Reports}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,35">
                    <dxg:GridControl.Columns>
                        <!--Visible by default-->
                        <dxg:GridColumn x:Name="Name" FieldName="Name" Width="68" />
                        <dxg:GridColumn x:Name="Feature1" FieldName="Data.Feature1" Width="75" Header="Working" />
                        <dxg:GridColumn x:Name="Feature2" FieldName="Datas[0].Feature1" Width="75" Header="Not Working"/>
                    </dxg:GridControl.Columns>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Loaded">
                            <Custom:EventToCommand Command="{Binding GridLoadedCommand}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <dxg:GridControl.View>
                        <dxg:TableView Name="tableView1" ShowTotalSummary="True" />
                    </dxg:GridControl.View>
                </dxg:GridControl>

public class MyViewModel
{
    public ObservableCollection<Report> Reports { get; set; }
}

public class Report
{
    public DateTime StartDateTime { get; set; }
    public Single Duration { get; set; }
    public Data Data { get; set; } //working with FieldName="Data.Feature1"
    public List<Data> Datas { get; set; } //not working FieldName="Datas[0].Feature1"

}

public class Data
{
    public byte Segment { get; set; }
    public Single Feature1 { get; set; }
    public Single Feature2 { get; set; }
}
4

0 回答 0