c# - WPF DataGrid CanUserAddRows event -


is there event or command use can invoke object getting added observablecollection before gets added?

at moment, once user clicks row in grid, adds collection, need assign properties in c# don't want assign in grid.

public void event {   // want before canuseraddrow event collection.add(<t>;  } 

you can use datagrid.initializingnewitem event:

private void initializingnewitem(object sender, initializingnewitemeventargs e) {     //use e.newitem here } 

from msdn

you can set default values new item handling initializingnewitem event , setting values programmatically


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -