Friday 15 April 2011

c# - Data Grid Template [WPF] -



c# - Data Grid Template [WPF] -

how type of info grid template can created??

i can't find way create template. or can u suggest other way??

i.e. grid view or , how!

the lastly column not required of now.

codebehind:

var pp = asd in db.ordermasters select new { asd.cfn, asd.location, asd.createdon, asd.quantity }; dgordermaster.itemssource = pp.tolist();

markup:

<datagrid x:name="dgordermaster" horizontalcontentalignment="center" borderthickness="1" margin="10" grid.row="3">

i worked around, , found listview way more helpfull task, here's markup:

<listview name="lvdatabinding" horizontalcontentalignment="stretch" borderthickness="0" margin="10" grid.row="3" background="{x:null}"> <listview.itemtemplate> <datatemplate> <border borderbrush="black" borderthickness="0" cornerradius="3" margin="0,3" grid.columnspan="4" background="white"> <grid background="white" margin="0,1"> <grid.columndefinitions> <columndefinition /> <columndefinition /> <columndefinition width="1.5*"/> <columndefinition /> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition height="60"/> </grid.rowdefinitions> <stackpanel orientation="vertical" margin="50,5" > <textblock text="customer" foreground="#33b6ef" fontsize="20" /> <textblock text="{binding cust}" fontsize="20" /> </stackpanel> <stackpanel orientation="vertical" grid.column="1"> <textblock text="location" foreground="#33b6ef" fontsize="20" /> <textblock text="{binding loc}" fontsize="20" /> </stackpanel> <stackpanel orientation="vertical" grid.column="2"> <textblock text="created on" foreground="#33b6ef" fontsize="20" /> <textblock text="{binding con}" fontsize="20" /> </stackpanel> <stackpanel orientation="vertical" grid.column="3"> <textblock text="quantity" foreground="#33b6ef" fontsize="20" /> <textblock text="{binding quant}" fontsize="20" /> </stackpanel> </grid> <border.effect> <dropshadoweffect blurradius="5" shadowdepth="5" /> </border.effect> </border> </datatemplate> </listview.itemtemplate> </listview>

c# wpf datagrid

No comments:

Post a Comment