I've been searching near and far through the web to fin a working exemple of how to set an ultradropdown in a grid cell ... and everything I've found seems very basic ... and yet I cant make it work ... could anyone point me the error ? My datatable seems correct, and in debug mode I can set the tooltiptext correctly (at the end of my "CreateUltraDropDown" section )
Yet, in the end, this cell is always empty. When I set en event in the initializeRow, I can see the valuelist is empty, but the valuelistResolved is filled with what seems to be my ultradropdown, but the cell is still always empty. This is driving me nuts, all the exemple I've seen don't have anything more ... what am I missing here ?
Private Function CreateDataTableFromEnum(Of T)() As DataTable Dim dt As DataTable = New DataTable dt.Columns.Add("Display", GetType(String)) dt.Columns.Add("EnumValue", GetType(Integer)) dt.Columns.Add("Tooltip", GetType(String)) For Each value As T In [Enum].GetValues(GetType(T)) Dim desc As String = GetDescFromResx(value) Dim tt As String = GetToolTipFromResx(value) dt.Rows.Add(New Object() {desc, value, tt}) Next dt.AcceptChanges() Return dt End Function Private Sub CreateUltraDropDown() dt = CreateDataTableFromEnum(Of TechniquesMinimum)() TechniqueMinDD = New UltraDropDown() TechniqueMinDD.SetDataBinding(dt, "") TechniqueMinDD.DisplayMember = "Display" TechniqueMinDD.ValueMember = "EnumValue" 'TechniqueMinDD.Rows.Band.Columns("EnumValue").Hidden = True 'TechniqueMinDD.Rows.Band.Columns("Tooltip").Hidden = True For x As Integer = 0 To (TechniqueMinDD.Rows.Count - 1) TechniqueMinDD.Rows.Item(x).ToolTipText = CStr(TechniqueMinDD.Rows.Item(x).Cells("ToolTip").Value) NextEnd SubPrivate Sub UgCout_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ugCout.InitializeLayout If IsNothing(TechniqueMinDD) Then CreateUltraDropDown() ugCout.DisplayLayout.Bands(0).Columns("TechniqueMinimum").ValueList = TechniqueMinDDEnd Sub
Hello Thierry,
You can refer to the below blog post on how to add an UltraDropDown to a UltraGrid cell:
http://blogs.infragistics.com/winforms/wiki/best-practices-for-placing-a-dropdown-or-combo-in-an-wingrid-cell/5.aspx
In the code snippet provided, I do see that ValueList is assigned to TechniqueMinimum instead of a Grid column. I recommend assigning the ValueList to required column in order to resolve this issue:
ugCout.DisplayLayout.Bands(0).Columns("TechniqueMinimum").ValueList = TechniqueMinDD
Please let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
Hooooo, ok ... If I force a value in my cell, I get the correct value displayed ...
Private Sub UgCout_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ugCout.InitializeRow e.Row.Cells().Item("TechniqueMinimum").Value = 1End Sub
I must find why the dropdown can't be used ... it's stay empty, even when I enter "edit mode" ... the "dropdown" button that would allow this cell to act like a dropdown is never shown, and the user cant type any text in the cell either.