Am I doing something wrong, in a normal combobox this works fine. However in the ultracombobox it displays the entire dataset reguardless of
DataSet ds1 = SqlHelper.ExecuteDataset(SqlConnection.String, CommandType.Text, "Exec dbo.procSecurityListSelect 'code'");ultraComboSecId.DataSource = ds1.Tables[0];ultraComboSecId.DisplayMember = "code";ultraComboSecId.Value = "sec_id";
Hi,
this took a while to solve, but now seems not only logical but obvious
uCbo.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList
uCbo.DisplayMember = "code"
uCbo.ValueMember = "sec_id"
' now we hide the columns that we dont wish to see
uCbo.Rows.Band.Columns(1).Hidden = True
' now lets hide the column headers
uCbo.Rows.Band.ColHeadersVisible = False
' and finally we set the width of the remaining column to the width of the control
uCbo.Rows.Band.Columns(0).Width = uCbo.Width
Hope this helps
regards
Andy (Dogs)
It works well provided there is no verticle scrollbar. In the past I've hardcoded an offset, but that seems to be a real hack and not very flexible. For example say a new version of windows changes the standard width of a scrollbar.
Is there a way to get the single column to automatically adjust to the scrollbar's presence/absense?
I'm afraid I don't understand your question. I don't understand the signifcance of the presence of a vertical scrollbar and how that relates to the rest of this thread.
Let's say we have a combobox that has a width of 500. So we set the width of our dropdown to 500.
For illustration purposes let's consider the width as 50 x's.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
As our dropdown gets larger a verticle scrollbar shows up. Now our visible drowdown width is only 450 with 50 used by the verticle scrollbar.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyy
The combox treats the area under the scrollbar as usable space so now a horizontal scrollbar shows up to allow us to scroll into the area that's under the verticle scrollbar. Normally I don't want that. The approach I've used in the past is to set the dropdown width to "combobox width - verticle scrollbar width". However, I don't know of a way programatically to determine if the scrollbar is visible and if it's visible to determine the scrollbar width.
Thanks! Works awesome. :-)
Okay.
I guess you can determine if the vertical scrollbar is visible using by checking MaxDropDownItems against the actual number of items on the list.
The scrollbar width is a system setting. I think you can get it from the SystemInformation.VerticalScrollBarWidth property.
Yes. The column i'm displaying in the dropdown is narrower than the width of the combo box. So I am expanding the column's width.
Okay... just to make sure I understand the issue, are you talking about UltraCombo or UltraComboEditor? The original poster was discussing UltraCombo, but you seem to be talking about UltraComboEditor here.
Also, just to be clear, it seems like this is completely unrelated to the original poster's issue. The OP was talking about the fact that the combo displays multiple columns, and you're talking about autosizing with the width of the combo here. Is that correct?
Either way, I am pretty sure that both of these controls autosize the dropdown by default so the contents will fit, including the scrollbar if neccessary. The only reason they would not do this is if you set the DropDownWidth to something other than the default. Is that the case?