Hi, i've been working on this for a while and found some great tips here. But nothing is working .
my problem is:
i have a wingrid bound to bindinglist<T> of a custom DTO. this list is bound to the grid, no problem. i have a saved version of a layout from this grid with all the columns the grid had at the time (i called savelayouttoxml). since then, i have added (only added) new columns to the dto and no matter what i do i always see those columns after i call loadlayoutfromxml. fine, there are new columns the layout doesn't know about it so it shows them. how can i hide them?
i tried hiding all columns before calling loadinglayoutfromxml() but these new columns are always visible. i know they are not in the layout file. even putting the columns at the end of the grid is better than seeing them there. they are right in the front of the grid everytime i add new columns.
i'm currently using layoutcategories.SortedColumns.
what can i do? i've been bald for 20 years and i think i'm going to start pulling my arm hair out.
thanks in advance
Hi Al,
PropertyChanged is a sort've catch-all for any property changing anywhere in the grid. Although it's actually not that simple, because there are certain properties in the grid that are ignored for performance reasons.
Using that event will work to a certain extent, but it may be overkill. PropertyChanged may fire for things that don't affect the layout (although I can't think of an example, off hand).
The alternative would be to use a multitude of events and try to catch all of the possible ways in which the user might alter the layout, so PropertyChanged is certainly the easiest event to use.
looks like PropertyChanged (Infragistics.Win.PropertyChangedEventArgs ) does what i'm looking for. so far it works with testing.
sorry, I mean comparing a copy of the layout before to a copy of the layout after.
hey Mike,
is it possible, using the same idea of copying layouts, to determine whether or not something in the layout has changed. So when the user closes the form I can do that check and ask them if they want to save the changes or not.
Thanks again
wTh. that worked like a charm mike. thanks.