Hello,
how can I achieve that the dropdown container has the optimal width.
Optimal means the width of the "longest" item in the dropdownlist.
I tried this
http://es.infragistics.com/community/forums/p/82515/412900.aspx#412900
but this does not work in Version 14.1.
Border border = (sender as Popup).Child as Border;border.Width = double.NaN;
The Child is a Grid not a Border anymore. I tried casting to the grid, but this not work.
Thanks for your help
Markus
Hi Gergana,
generally this hack works - thanks.
But if there are no items in the itemsource then this crashes:
German:
Beim Überschreiben der Layoutmessung des Elements "Infragistics.Controls.Editors.Primitives.ItemsPanel" sollte als "DesiredSize" nicht "PositiveInfinity" zurückgegeben werden, auch wenn "Infinity" als verfügbare Größe übergeben wird.
Translated:
When overwriting the layoutmeasurement of element "Infragistics.Controls.Editors.Primitives.ItemsPanel", the DesiredSize should not return PositiveInity ...
You can reproduce it when commenting out the line "d.Rows.Add(row);" in your example.
Stacktrace:
bei System.Windows.UIElement.Measure(Size availableSize)
bei System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) bei System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged) bei System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) bei System.Windows.Controls.Grid.MeasureOverride(Size constraint) bei System.Windows.FrameworkElement.MeasureCore(Size availableSize) bei System.Windows.UIElement.Measure(Size availableSize) bei System.Windows.Controls.Border.MeasureOverride(Size constraint)
I tried to get the itemscount of the combobox. If there are no items then ignore setting the width. But how could I get "generic" the amount of items. I have a lot of comboboxes therefor a generic way would be fine.
Regards
Hello Markus,
Thank you for contacting Infragistics!
I have been looking into your issue and have created a small sample application for you. In the sample application I am using the same XamComboEditor, that is used in the blog post you have provided. Then in the Opened event I am getting the Grid you have mentioned. Then using the Utilities class I am getting the first child of the grid, which is the border from the previous sample application.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.