Hi allI am trying to build a very simple ultraCombo.I have a DataTable with some string entries.I have set DataSource = DataTable.Now, the DropDown has a header and also the size (width)does not fit with the ultraCombo control.How can I do this ?Just set the dataSource and when the user clicks on the buttonthe dropDown should be just a list of entries and the width shouldbe the same width als the ultraCombo.Thanks and best regardsFrank UrayI have tried the following:
this.ultraCombo_ConnectionA_Source_Server.DataSource = GetSQLServers(); this.ultraCombo_ConnectionA_Source_Server.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDown; this.ultraCombo_ConnectionA_Source_Server.DropDownWidth = this.ultraCombo_ConnectionA_Source_Server.Width; this.ultraCombo_ConnectionA_Source_Server.DisplayLayout.UseFixedHeaders = false; this.ultraCombo_ConnectionA_Source_Server.DisplayLayout.Override.ColumnAutoSizeMode = Infragistics.Win.UltraWinGrid.ColumnAutoSizeMode.AllRowsInBand;
I have a routine I use to do this repetitive task. It takes into account if the width of the text displayed in the drop down as well as one or two columns.
Public Sub SetDropDownWidth(ByRef oCombo As Infragistics.Win.UltraWinGrid.UltraCombo, ByVal ColumnName As String, Optional ByVal ColumnName2 As String = Nothing) Try oCombo.DisplayLayout.Bands(0).Columns(ColumnName).Width = oCombo.DisplayLayout.Bands(0).Columns(ColumnName).CalculateAutoResizeWidth(Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, True) If ColumnName2 IsNot Nothing Then oCombo.DisplayLayout.Bands(0).Columns(ColumnName2).Width = oCombo.DisplayLayout.Bands(0).Columns(ColumnName2).CalculateAutoResizeWidth(Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, True) End If If oCombo.DisplayLayout.Bands(0).Columns(ColumnName).Width < oCombo.Width Then If ColumnName2 IsNot Nothing Then oCombo.DisplayLayout.Bands(0).Columns(ColumnName).Width = oCombo.Width * 0.7 oCombo.DisplayLayout.Bands(0).Columns(ColumnName2).Width = oCombo.Width * 0.3 Else oCombo.DisplayLayout.Bands(0).Columns(ColumnName).Width = oCombo.Width End If End If Catch ex As Exception HandleError(ex, "modControlLayout", "SetDropDownWidth") End Try End Sub