c# - Command - binding from DataGridTemplateColumn -
<datagrid itemssource="{binding occerences}" autogeneratecolumns="false" isreadonly="true"> <datagrid.columns> <datagridtextcolumn header="start index" binding="{binding start}" /> <datagridtextcolumn header="end index" /> <datagridtextcolumn header="length" /> <datagridtextcolumn header="pattern" /> <datagridtemplatecolumn header="sequence"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button content="sequence" command="{binding sequencecommand}" /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> <datagridtemplatecolumn header="export"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button content="export" /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> </datagrid.columns> </datagrid> <button content="sequence" command="{binding sequencecommand}" />
this not working. how bind sequencecommand (myviewmodel, icommand sequencecommand)?
i can't use frameworks (mvvm light tool kit, prism, etc).
the datacontext in datatemplate
celltemplate changed bind current item sequencecommand not found. have set relativesource datagrid
, set path
datacontext.sequencecommand
this:
<button content="sequence" command="{binding relativesource={relativesource ancestortype=datagrid}, path=datacontext.sequencecommand}" />
Comments
Post a Comment