c# - Add blank row at the end of a WPF datagrid conditionally (without using a default parameterless ctor) -
i trying add together blank row @ end of wpf 4.0 datagrid conditionally (not via code-behind directly). have tried next in vain -
i have tried ieditablecollectionview , operate upon interface:
collectionviewsource.getdefaultview(myobservablecollection) ieditablecollectionview
but, not work intended because 1 of factors canaddnew property true add together default constructor underlying object of collection (to grid bound to).
problem: if add together default constructor, grid adds blank row. want add together upon condition (checking bool value) , not always. how do without using default parameterless constructor viewmodel class ?
you can bind canaddnew property in model, can set true/false depends on condition:
<datagrid canuseraddrows="{binding path=yourbooleanproperty}"/>
c# wpf wpfdatagrid
No comments:
Post a Comment