c# - Problems with BindlingList<T> and combo box -
i have got following code:
private bindinglist<inoun> _nouns; private bindinglist<inoun> nouns { { if ( _nouns == null ) { _nouns = new bindinglist<inoun>( _model.feature.nouns ); _nouns.insert( 0, new noun( -1, "please select..." ) ); } return _nouns; } } public interface inoun { int id; string text; }
the nouns
property bound combobox
adds default entry please select...
bindinglist
.
the issue having here please select...
entry unexpectedly being added underlying_model.feature.nouns
collection , not want happen.
is there anyway can add please select...
default item combobox without being added underlying collection?
thanks
bindinglist
wrapper, notifications, around _model.feature.nouns
remains underlying list of items (that's why have allowedit, allownew, allowremove
on bindinglist
) :
if want work on brand new list (though i'm not sure it's purpose of bindinglist), try :
_nouns = new bindinglist<inoun>( _model.feature.nouns.select(x=>x).tolist());
Comments
Post a Comment