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
1500
Minimal size of the list view needed to display all its items
posted

Hello,

I'm hosting ListView in a  DropDownEditorButton button. The dropdown button and the ListView should look and feel like a regular combobox. The dropdown button hosts the ListView and shows it as expected. My question is: how to determine the size of the ListView necessary and sufficient to show all items (there will be just a couple of them) without scrolling and elipsis?

Here is the code how I expect that to be done:

listView.View = UltraListViewStyle.List;
listView.ItemSettings.SelectionType = SelectionType.Single;
listView.ViewSettingsList.ColumnWidth = -1;

listView.Items.Add("Entry One", "Entry One");
listView.Items.Add("The second entry", "The second entry");

listView.Size = GetSufficientSize(listView);
 
The part that is missing here is the GetSufficientSize method implementation.

Thanks,
Vitaly 

Parents
  • 69832
    Offline posted

    The control does not publicly expose a way to determin the size required to show all items without a scrollbar. Note that a ComboBox actually does not do that either, it has a MaxDropDownItems property which determines how many items appear in the viewable area.

Reply Children
No Data