wpf - Binding DataGirdComboBoxColumn to DataSet doesn't work -


i want create simple master-detail view in datagrid.
tried bind datagirdcomboboxcolumn dataset, won't work.

here's xaml code:

<datagrid x:name="datagrid1" grid.column="0" grid.row="0" alternatingrowbackground="#fff0f0f0" itemssource="{binding}" height="420" autogeneratecolumns="false">     <datagrid.columns>         <datagridtextcolumn header="id" binding="{binding airplaneid}" isreadonly="true" minwidth="30"/>         <datagridtextcolumn header="model" binding="{binding model}" isreadonly="true" width="auto" minwidth="160"/>         <datagridtextcolumn header="fuel" binding="{binding fuel}" minwidth="50" />          <datagridcomboboxcolumn x:name="comboboxcolumnpass" header="passenger" displaymemberpath="name"                                         selectedvaluebinding="{binding airplaneid, mode=twoway, updatesourcetrigger=propertychanged}" selectedvaluepath="airplaneid"/>        </datagrid.columns>     <datagrid.contextmenu>         <contextmenu>             <menuitem command="applicationcommands.new" tooltip="fügt eine neue zeile hinzu"/>             <menuitem command="applicationcommands.delete"  tooltip="löscht das ausgewählte element"/>         </contextmenu>     </datagrid.contextmenu>     <datagrid.rowdetailstemplate>         <datatemplate>             <stackpanel orientation="horizontal" margin="5">                 <textblock fontsize="12" textwrapping="wrap" text="{binding detail}" />             </stackpanel>         </datatemplate>     </datagrid.rowdetailstemplate> </datagrid> 

and here's c# code:

namespace wpfapplicationairplanedb {     airplanedbdataset airplanedataset = new airplanedbdataset();     airplanedbdatasettableadapters.airplanetableadapter airtableadapter = new airplanedbdatasettableadapters.airplanetableadapter();     airplanedbdatasettableadapters.passengertableadapter passtableadapter = new airplanedbdatasettableadapters.passengertableadapter();      public mainwindow()     {         initializecomponent();          airtableadapter.fill(airplanedataset.airplane);         passtableadapter.fill(airplanedataset.passenger);          datagrid1.itemssource = airplanedataset.airplane.defaultview;         comboboxcolumnpass.itemssource = airplanedataset.passenger.defaultview;      } } 

and error:

an unhandled exception of type 'system.invalidoperationexception' occurred in presentationframework.dll additional information: twoway- oder onewaytosource-bindungen funktionieren nicht mit der schreibgeschützten eigenschaft "airplaneid" vom typ "system.data.datarowview".

(sorry german language exception)

it seems airplaneid readonly. either make writeable or change binding oneway.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -