"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.
Hi Joe,
That may make a difference with some of the timing involved in my solution. Certain events need to be fired in a specific order for it to work on the first try. Let me convert this sample over to Silverlight to see what's going on.
Rob,
Thank yo for the quick response, I had been reading that post as well as using the sample code to try to find a solution. I have made progress in that I can now size the drop list to display the columns wide enough to show all text. What I am finding frustrating is the first time into the event handler for popup_Opened, the DependecyObject returned by FindFirstRow doesn;t have any children and therefore skips the code to figure out the widths of each column. So what ends up happening is that my drop list is only as wide as the edit box portion of the control. Then when I close the drop list and reopen it, the list is sized appropriately. However, it may take 2 or 3 times to open and close the list before I get the width I expect. On the upside, once I get the width I want the list stays that size.
Any ideas?
I am using the Silverlight 5 controls, does that make a difference?
I recommend taking a look at this forum post. It contains a sample that's basically an updated version of this thread's sample. It should help you handle that case where the header portion is the first child. http://es.infragistics.com/community/forums/t/73322.aspx
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.