views:

333

answers:

1

Hello, does anyone knows, which event is raised, when user changes width of column for WPF DevExpress grid? I want to use it to store columns widths in database.

+1  A: 

I've had to do the same, but for the silverlight grid. The best i could get was to handle the Grid.LayoutUpdated event, and enumerate the columns to get their widths. I couldn't even bind to the column width property in the silverlight grid because it wasn't a dependency property, the WPF grid is most likely exactly the same.

EDIT: what you could do though is check through the source code of the WPF grid, and add a ColumnResized event yourself. It's not ideal, because you would have to re-integrate the code everytime you installed a DevExpress update, and then rebuild the grid. You would also need to be careful how you do it, for instance you need to work out the best way to determine when a column resize has finished, so that you don't continually fire the event. Or you could look round for a more fully featured (more mature) grid?

slugster
I tried, this event is raised every 5 seconds automaticaly, that would seriuosly slow down my app. So i think we must search for some better way or event.
Vytas999
Or maybe there we must thing some way to indicate, when the user updates the layout and when it raised automaticaly.
Vytas999
LostMouseCapture - works a little better, if noone would answer or suggest a better way, I thing thats would the best way for my purpose.
Vytas999
I done hybridicaly, when LostMouseCapture raised, iset property WithChanged to true, and in LayoutUpdated event i check if WithChanged is true. If it is, then i save my column withs.
Vytas999
Cool, glad you got a solution. I don't want to diss DevExpress too much and i've been using their stuff for a few years, but i seriously think they need to improve their game with their WPF and Silverlight controls - especially when even simple stuff like ColumnChanged events are missing.
slugster