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://ko.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
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.
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
Thank you for the feedback. Please do not hesitate to let me know if you have any further questions on this matter.
... I don't understand the world anymore :(
An absolutely standard behavior does not work. I am quite disappointed.
I added my super new Idea.
Hello Marcus,
After working on the functionality that you are trying to achieve and doing some research, the ability to set the width of the dropdown of the XamComboEditor between the minimum and maximum values automatically has been determined to be a new product idea. You can suggest new Product Ideas for future versions (or vote for existing ones) at http://ideas.infragistics.com.
Steps to create your idea:
1. Log into the Infragistics Product Ideas site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
The benefits of submitting the product idea yourself include:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
Additional benefits of the Product Idea system include:
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
The product ideas site allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
Thanks for your example. There is no exception more.But now there is the following problem (please see the modified sample):
Scenario 1:- starting the app, there are no items assigned, when opening the combobox -> ok- After this I fill the itemsource and open the combobox again -> not ok: width and hight are incorrect
Scenario 2:- starting the app again and "fill the itemsource", when opening the combobox -> ok- clearing the itemsource and open combobox again -> expected behvior ok- filling the itemsource again and open combobox again -> not ok: width and hight are incorrect
I tried several variants, what event should handle the width ... but I couldn't find any solution for a standard optimal behavior.The optimal behavior would be that the width and height would be set automatically between Min/Max-Sizes depending on the items.I used devexpress before, and I had to do nothing to get this normal behavior.Also I tried the default ComboBox -> it's simple working
Thanks for any help,
I have been looking into your issue and have modified the sample application I have sent in my previous post!
In the Loaded event of the XamCombEditor I get the count of the items in the dropdown of the xamComboEditor. If the count is equal or bigger than 1 I set the Opening event for the Popup.
One more thing I can suggest is to use the MinWidth and MaxWidth for the dropdown of the XamComboEditor. More about these properties you can find on the following link from our documentation: http://help.infragistics.com/Doc/WPF/current/CLR4.0/?page=Whats_New_in_2014_Volume_1.html.