Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
34510
Size multi-column comboeditor dropdown to show all columns
posted

"In the XamMultiColumnComboEditor, I want to stop the dropdown from resizing past the last column in the grid.  I also want the dropdown to initially display the full width of the grid."

The XamMultiColumnComboEditor uses a Popup control for the drop down so you need to use this to find the column CellControls which will give you the widths you need.  The only problem is that using the combo editor's DropDownOpened event won't give you the widths on the first try because the Columns haven't been created yet.  This is where you need to handle the Popup's Opened event.  This event occurs after the columns are created so we'll use it to traverse down the VisualTree of the popup and look for the first row in the grid.  We then add up the widths of all the cells in that row and set the popup's width.  At the same time we should set the Popup's MaxWidth to the same value so that resizing the dropdown won't let you go past the last column.

I've attached a sample that demonstrates the above method.

xamMultiColumnCombo.zip
Parents
  • 375
    Offline posted

    OK, I have been attempting to implment this sizing solution for a few days and I am having some issues. First off my multi-column comboeditor is displaying a header, and also the checkbox for marking multi-selected items from the list. What i find happening is that the call to VisualTreeHelper.GetChild(itemsPanel, i) as ComboCellControl, always returns null. What i found was that the first child of the panel is the header portion for the checkbox column and therefore cannot be cast into a ComboCellControl. What would be your suggestion as to how to tackle this? I am stumped.

Reply Children