Question

I have a WPF usercontrol that holds a grid, some textboxes, and a DataGrid. The textboxes are filers for the data in each column so I'd like them to stay above the relevant column. This is easy unless the user resizes the DataGridTextColumn. So, I am Binding the Grid.ColumnDefinition.Width to the DataGridTextColumn.Width.

It works like a dream... after the first resize. When the form initially opens the textbox is 0 wide. How do I trigger the resize event on the datagrid? Currently I'm binding in the XAML, should I wait until the control is initialized and then do the binding in code?

Was it helpful?

Solution

This works if you set the width in the constructor for the usercontrol. I can't quite follow the event stack but it seems the width changing event is happening after the bind.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top