c# - Reading from Datagrid Textbox -
i have datagrid , in there 3 columns , values of 2 columns fetched database , populated whereas third column textbox user enters value. have save value database . facing problem here . when enter value in ui , showing null in background code ..what doing wrong ?
<datagrid autogeneratecolumns="false" height="233" name="datagrid1" width="360" > <datagrid.columns> <datagridtextcolumn header="x" binding="{binding path=x}" width="120" isreadonly="true" /> <datagridtextcolumn header="y" binding="{binding path=y}" width="120" isreadonly="true"/> <datagridtextcolumn header="value/ref" width="120" binding="{binding path=z, mode=twoway}" isreadonly="false" /> </datagrid.columns> i have class containing variables x,y,z . creating list of class , trying add values class
with xaml code , simple code snippet, behaviour want (what understand):
class { private string _x, _y, _z; public string x { { return _x; } set { _x = value; } } public string y { { return _y; } set { _y = value; } } public string z { { return _z; } set { _z = value; } } } public partial class mainwindow : window { private list<a> mydata; public mainwindow() { initializecomponent(); mydata = new list<a>(); mydata.add(new a() { x = "x1", y = "y1" }); mydata.add(new a() { x = "x2", y = "y2" }); mydata.add(new a() { x = "x3", y = "y3" }); datagrid1.itemssource = mydata; } } if type in data in column value/ref, list behind updated.
Comments
Post a Comment