wpf - How to bind a grid column to a specific item in a collection -
here i'm attempting do...please advise if possible , how achieve?
<dxg:gridcolumn x:name="featureaverage" fieldname="datas[0].featureaverage" width="75" header="avg" /> if change list datas property single value (not collection), following works properly.
<dxg:gridcolumn x:name="featureaverage" fieldname="data.featureaverage" width="75" header="avg" /> edit: devexpress dxgrid control container , sample classes...
the entire grid here...
<dxg:gridcontrol x:name="gridcontrol1" itemssource="{binding reports}" horizontalalignment="stretch" verticalalignment="stretch" margin="0,0,0,35"> <dxg:gridcontrol.columns> <!--visible 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 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; } }
Comments
Post a Comment