Event Column Width Changes. Header Mouse down not working

Jul 3, 2009 at 5:05 PM


I have the following problem: I have the WPF Datagrid which gets filled from clipboard. Since the program does not know at time of filling, which column is which, I wanted to implement a column mapping, meaning, above the datagrid I have comboboxes where the user can indicate what the column in the datagrid below contains (the column names are predefined, just the order how it comes from the clipboard can be different).

Now, when the user changes the column width of the datagrid, I want the width of the comboxes to change as well. First I tried with data binding, which does not seem to work. Next thing I tried was catching some sort of columnwidth change event, but I could not find one. So I looked for a Click Event,and found the "MouseUp" event, which when triggered, calls a sub that sets the comboboxes width to the datagrid width.

Unfortunately, the MouseUp Event only triggers when the user clicks in the datagrid into the empty area, meaning, it does not fire when header or cells are being clicked, just when the unused area of the grid is being clicked (or MouseUped if you wish).´

Any crack here has any idea?