c# - how to show the following output in wpf datagrid depending on a condition -


i displaying processing time data in datagrid follows

enter image description here

using following statement

  var duration_query = this.db.events                        .where(p => id.contains(p.serverid) &&                        p.type == "complete" &&                        // fromdp , todp name of datapicker control                        (p.date >= fromdp.selecteddate.value &&                          p.date <= todp.selecteddate.value))                        .groupby(p => p.duration)                        .select(g => new                        {                        duration = g.key,                        serverid = g.count()                        })                        .orderby(x => x.duration).tolist();    dgprocessingtime.itemssource = duration_query.tolist(); 

xaml

i have used layout transform rotate datagrid header.

    <datagrid x:name="dgprocessingtime" itemssource="{binding}" autogeneratecolumns="false" canuseraddrows="false">         <datagrid.columns>      <datagridtextcolumn x:name="timecolumn" header="time in seconds" binding="{binding path=duration, mode= oneway}"></datagridtextcolumn>      <datagridtextcolumn x:name="amountcolumn" header="amount of events" binding="{binding path=serverid, mode= oneway}"></datagridtextcolumn>      </datagrid.columns>     </datagrid>        

how display same result ? in multiples of 10 ( time in seconds?)

<10 <20 <30 <40

and count amount of events above condition?

do have alter select statement have used above, groups , counts amount of events <20 example ?

i haven't tried give try:

  var duration_query = this.db.events                        .where(p => id.contains(p.serverid) &&                        p.type == "complete" &&                        // fromdp , todp name of datapicker control                        (p.date >= fromdp.selecteddate.value &&                          p.date <= todp.selecteddate.value))                        .groupby(p => (((int)(p.duration / 10)) + 1)*10)                        .select(g => new                        {                        duration = g.key,                        serverid = g.count()                        })                        .orderby(x => x.duration).tolist();    dgprocessingtime.itemssource = duration_query.tolist(); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -