When an UltraDropDown is activated (i.e. single clicked) in my grid and the mouse scroll wheel moved the selected value in the UltraDropDown changes even though it has not dropped down. Typically my users are just wanting to scroll the grid in this situation. What do I need to change to make the grid scroll and not the UltraDropDown in this situation?
I am currently using 2007 Vol. 2 but can switch to the latest release if necessary.
maybe you can take a look at following method
Dim ug As UltraGridug.PerformAction(UltraGridAction.ToggleDropdown)ug.PerformAction(UltraGridAction.CloseDropdown)ug.PerformAction(UltraGridAction.EnterEditModeAndDropdown)Dim ugCell As UltraGridCellugCell.DroppedDown = TrueugCell.DroppedDown = False
For some reason I can not intercept MouseWheel hack posted.
Is there a way I can ALWAYS show dropdown when the user enters into the cell that has dropdown?
This is what happens now: First time when I click into the cell that has dropdown it will show the drop down and one more soft click in that cell makes the dropdown invisible and from then onwards UP/DOWN/MOUSEWHEEL changes the selected value of the dropdown.
So I was hoping If I can show the dropdown all the time then up/down/mousewheel effect the scroll bar on the dropdown instead of changing the selected value in the dropdown.
Thanks in advance.
My solution was simple. I used the original code for the VB6 IDE mouse wheel fix and instead of giving the Parent Window Hwnd i give it the Hwnd of the grid from Form_Load. ////////// modMouseWheel///////////////////////////// Option Explicit Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent _ As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Declare Function EnumThreadWindows Lib "user32" (ByVal dwThreadId _ As Long, ByVal lpfn As Long, ByVal lParam As Long) As Long Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _ (ByVal hwnd As Long, ByVal lpClassName As String, _ ByVal nMaxCount As Long) As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, _ ByVal cch As Long) As Long Public Declare Function GetCurrentThreadId Lib "kernel32" () As Long Public Declare Function CallWindowProc Lib "user32" Alias _ "CallWindowProcA" _ (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) _ As Long Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As _ Long, ByVal lParam As Long) As Long Public Declare Function WindowFromPointXY Lib "user32" _ Alias "WindowFromPoint" (ByVal xPoint As Long, _ ByVal yPoint As Long) As Long Private Declare Function SystemParametersInfo Lib "user32" _ Alias "SystemParametersInfoA" _ (ByVal uAction As Long, _ ByVal uParam As Long, _ lpvParam As Any, _ ByVal fuWinIni As Long) As Long Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function WindowFromPoint Lib "user32" (pt As POINTAPI) As Long Public Declare Function GetWindowInfo Lib "user32" (ByVal hwnd As Long, ByRef pwi As WINDOWINFO) As Boolean Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Public Declare Function FreeLibrary Lib "kernel32" Alias "FreeLibraryA" (ByVal hLibrary As Long) As Boolean Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type WINDOWINFO cbSize As Long rcWindow As RECT rcClient As RECT dwStyle As Long dwExStyle As Long cxWindowBorders As Long cyWindowBorders As Long atomWindowtype As Long wCreatorVersion As Long End Type Private Type POINTAPI x As Long Y As Long End Type Private Type MOUSEHOOKSTRUCT pt As POINTAPI hwnd As Long wHitTestCode As Long dwExtraInfo As Long End Type Private Type MSLLHOOKSTRUCT pt As POINTAPI mouseData As Long flags As Long time As Long dwExtraInfo As Long End Type Private Const WM_MOUSEWHEEL = &H20A Private Const WM_MBUTTONUP = &H208 Private Const WM_MBUTTONDOWN = &H207 Private Const WM_MBUTTONDBLCLK = &H209 Private Const WM_LBUTTONDOWN = &H201 Private Const WM_LBUTTONUP = &H202 Private Const WM_RBUTTONUP = &H205 Private Const MK_LBUTTON = &H1 Private Const MK_MBUTTON = &H10 Private Const MK_RBUTTON = &H2 Public Const WH_MOUSE = 7 Private Const WHEEL_DELTA = 120 Private Const WM_VSCROLL = &H115 Private Const WM_USER As Long = &H400 Private Const WM_SOMETHING = WM_USER + 3139 Public Const GWL_WNDPROC = -4 Public Const WH_MOUSE_LL = 14 Public Const SB_LINEUP = 0 Public Const SB_LINELEFT = 0 Public Const SB_LINEDOWN = 1 Public Const SB_LINERIGHT = 1 Public Const SB_ENDSCROLL = 8 Public Const WS_VISIBLE = &H10000000 Public Const SBS_VERT = 1 Public Const SBS_HORZ = 0 Public Const WM_HSCROLL = &H114 Public Const SPI_GETWHEELSCROLLLINES = 104 Public Enum mButtons LBUTTON = &H1 MBUTTON = &H10 RBUTTON = &H2 End Enum Public Const REG_SZ As Long = 1 Public Const REG_DWORD As Long = 4 Public Const HKEY_CLASSES_ROOT = &H80000000 Public Const HKEY_CURRENT_USER = &H80000001 Public Const HKEY_LOCAL_MACHINE = &H80000002 Public Const HKEY_USERS = &H80000003 Public Const ERROR_NONE = 0 Public Const ERROR_BADDB = 1 Public Const ERROR_BADKEY = 2 Public Const ERROR_CANTOPEN = 3 Public Const ERROR_CANTREAD = 4 Public Const ERROR_CANTWRITE = 5 Public Const ERROR_OUTOFMEMORY = 6 Public Const ERROR_ARENA_TRASHED = 7 Public Const ERROR_ACCESS_DENIED = 8 Public Const ERROR_INVALID_PARAMETERS = 87 Public Const ERROR_NO_MORE_ITEMS = 259 Public Const KEY_QUERY_VALUE = &H1 Public Const KEY_SET_VALUE = &H2 Public Const KEY_ALL_ACCESS = &H3F Public Const REG_OPTION_NON_VOLATILE = 0 Declare Function RegCloseKey Lib "advapi32.dll" _ (ByVal hKey As Long) As Long Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _ "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _ ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions _ As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes _ As Long, phkResult As Long, lpdwDisposition As Long) As Long Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _ "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _ ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _ Long) As Long Declare Function RegQueryValueExString Lib "advapi32.dll" Alias _ "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _ String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _ As String, lpcbData As Long) As Long Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias _ "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _ String, ByVal lpReserved As Long, lpType As Long, lpData As _ Long, lpcbData As Long) As Long Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias _ "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As _ String, ByVal lpReserved As Long, lpType As Long, ByVal lpData _ As Long, lpcbData As Long) As Long Declare Function RegSetValueExString Lib "advapi32.dll" Alias _ "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _ ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As _ String, ByVal cbData As Long) As Long Declare Function RegSetValueExLong Lib "advapi32.dll" Alias _ "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _ ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, _ ByVal cbData As Long) As Long Dim nKeys As Long, Delta As Long, XPos As Long, YPos As Long Dim OriginalWindowProc As Long Dim pthWnd As Long Dim lLineNumbers As Long Dim MainWindowHwnd As Long ' Main IDE window handle Dim bHook As Boolean Dim sLib As String Dim hLib As Long Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) _ As Long Select Case uMsg Case WM_MOUSEWHEEL nKeys = wParam And 65535 Delta = wParam / 65536 / WHEEL_DELTA XPos = LowWord(lParam) YPos = HighWord(lParam) pthWnd = WindowFromPointXY(XPos, YPos) ' Get the scroll bar for this window and send the vscroll to it Dim lret As Long lret = EnumChildWindows(pthWnd, AddressOf EnumChildProc, lParam) End Select If OriginalWindowProc <> 0 Then WindowProc = CallWindowProc(OriginalWindowProc, hwnd, uMsg, wParam, lParam) End If End Function Public Sub UnHook(ByVal hwnd As Long) 'Ensures that you don't try to unsubclass the window when 'it is not subclassed. If OriginalWindowProc = 0 Then Exit Sub 'Reset the window's function back to the original address. Dim hr As Long hr = SetWindowLong(hwnd, GWL_WNDPROC, OriginalWindowProc) If hr <> 0 Then OriginalWindowProc = 0 bHook = False Else Debug.Print "Unable to unhook: SetWindowLong returns " & vbCrLf & hr & vbCrLf & Err.LastDllError End If End Sub 'Public Sub WheelHook(ByVal hwnd As Long) ' On Error Resume Next ' SetProp hwnd, "PrevWndProc", SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc) 'End Sub Public Sub Hook(ByVal hwnd As Long)'was Hook() but we need to send hwnd of grid On Error GoTo Error ' GetLine Numbers SystemParametersInfo SPI_GETWHEELSCROLLLINES, 0, lLineNumbers, 0 ' Adjust just in case, otherwise we'll never get the scroll notification. If lLineNumbers = 0 Then lLineNumbers = 1 End If 'Then add the hwnd below OriginalWindowProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc) ' Set a flag indicating that we are hooking bHook = True ' Find out where we live on the filesystem Dim lRetVal As Long Dim sKeyName As String Dim sValue As String sKeyName = "CLSID\{B84F8C6E-BDDE-4384-9946-82EEE7F81D48}\InprocServer32" sValue = QueryValue(sKeyName, "") ' If we found where we live let's increase our ref count so we can do our own cleanup later If Len(sValue) > 0 Then sLib = sValue hLib = LoadLibrary(sLib) End If Exit Sub Error: Debug.Print "Unable to set hook: " & vbCrLf & Err.Description & vbCrLf & Err.LastDllError End Sub Function EnumChildProc(ByVal lhWnd As Long, ByVal lParam As Long) _ As Long Dim RetVal As Long Dim WinClassBuf As String * 255, WinTitleBuf As String * 255 Dim WinClass As String, WinTitle As String Dim WinRect As RECT Dim WinWidth As Long, WinHeight As Long RetVal = GetClassName(pthWnd, WinClassBuf, 255) WinClass = StripNulls(WinClassBuf) ' remove extra Nulls & spaces RetVal = GetWindowText(lhWnd, WinTitleBuf, 255) WinTitle = StripNulls(WinTitleBuf) ' see the Windows Class and Title for each Child Window enumerated 'Debug.Print " hWnd = " & Hex(lhWnd) & " Child Class = "; WinClass; ", Title = "; WinTitle ' You can find any type of Window by searching for its WinClass Dim lret As Long Dim i As Long ' Since we can have split windows we need to figure out which scroll bar to move. ' We can do this by comparing the Y position of the cursor against the vertical scrollbars ' that are children of the current window Dim wi As WINDOWINFO wi.cbSize = Len(wi) If GetWindowInfo(lhWnd, wi) And WinClass <> "MDIClient" Then If IsVerticalScrollBar(lhWnd) = True And wi.rcWindow.Top YPos Then ' TextBox Window If Delta > 0 Then ' Scroll Up Do While i lret = PostMessage(pthWnd, WM_VSCROLL, SB_LINEUP, lhWnd) i = i + 1 Loop Else ' Scroll Down Do While i > Delta * lLineNumbers lret = PostMessage(pthWnd, WM_VSCROLL, SB_LINEDOWN, lhWnd) i = i - 1 Loop End If ElseIf IsHorizontalScrollBar(lhWnd) = True Then If Delta > 0 Then ' Scroll Left Do While i lret = PostMessage(pthWnd, WM_HSCROLL, SB_LINELEFT, lhWnd) i = i + 1 Loop Else ' Scroll Right Do While i > Delta * lLineNumbers lret = PostMessage(pthWnd, WM_HSCROLL, SB_LINERIGHT, lhWnd) i = i - 1 Loop End If End If End If EnumChildProc = bHook ' Continue enumerating the windows based on whether we are hooking or not ' It's possible that the addin has already been requested to unload and in such a case we will call free library on ourselves ' to reduce our ref count since we incremented it on our own so we can do a clean shutdown If Not bHook Then If Not FreeLibrary(hLib) Then Debug.Print "Unable to FreeLibrary: " & Err.Number & vbCrLf & Err.LastDllError End If End If End Function Public Function StripNulls(OriginalStr As String) As String ' This removes the extra Nulls so String comparisons will work If (InStr(OriginalStr, Chr(0)) > 0) Then OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1) End If StripNulls = OriginalStr End Function Public Function IsVerticalScrollBar(hwnd As Long) As Boolean ' Check the style of the window specified by hWnd to see if it's a vertical scrollbar Dim wi As WINDOWINFO wi.cbSize = Len(wi) If GetWindowInfo(hwnd, wi) Then If (wi.dwStyle And WS_VISIBLE) > 0 And (wi.dwStyle And SBS_VERT) > 0 Then IsVerticalScrollBar = True Exit Function End If End If IsVerticalScrollBar = False End Function Public Function IsHorizontalScrollBar(hwnd As Long) As Boolean ' Check the style of the window specified by hWnd to see if it's a horizontal scrollbar Dim wi As WINDOWINFO wi.cbSize = Len(wi) If GetWindowInfo(hwnd, wi) Then If (wi.dwStyle And WS_VISIBLE) > 0 And (wi.dwStyle And SBS_HORZ) > 0 Then IsHorizontalScrollBar = True Exit Function End If End If IsHorizontalScrollBar = False End Function Private Function QueryValue(sKeyName As String, sValueName As String) As Variant Dim lRetVal As Long 'result of the API functions Dim hKey As Long 'handle of opened key Dim vValue As Variant 'setting of queried value lRetVal = RegOpenKeyEx(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_QUERY_VALUE, hKey) lRetVal = QueryValueEx(hKey, sValueName, vValue) RegCloseKey (hKey) QueryValue = vValue End Function Public Function SetValueEx(ByVal hKey As Long, sValueName As String, lType As Long, vValue As Variant) As Long Dim lValue As Long Dim sValue As String Select Case lType Case REG_SZ sValue = vValue & Chr$(0) SetValueEx = RegSetValueExString(hKey, sValueName, 0&, lType, sValue, Len(sValue)) Case REG_DWORD lValue = vValue SetValueEx = RegSetValueExLong(hKey, sValueName, 0&, lType, lValue, 4) End Select End Function Function QueryValueEx(ByVal lhKey As Long, ByVal szValueName As String, vValue As Variant) As Long Dim cch As Long Dim lrc As Long Dim lType As Long Dim lValue As Long Dim sValue As String On Error GoTo QueryValueExError ' Determine the size and type of data to be read lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch) If lrc <> ERROR_NONE Then Error 5 Select Case lType ' For strings Case REG_SZ: sValue = String(cch, 0) lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, _ sValue, cch) If lrc = ERROR_NONE Then vValue = Left$(sValue, cch - 1) Else vValue = Empty End If ' For DWORDS Case REG_DWORD: lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, _ lValue, cch) If lrc = ERROR_NONE Then vValue = lValue Case Else 'all other data types not supported lrc = -1 End Select QueryValueExExit: QueryValueEx = lrc Exit Function QueryValueExError: Resume QueryValueExExit End Function Private Function LowWord(ByVal inDWord As Long) As Integer LowWord = inDWord And &H7FFF& If (inDWord And &H8000&) Then LowWord = LowWord Or &H8000 End Function Private Function HighWord(ByVal inDWord As Long) As Integer HighWord = LowWord(((inDWord And &HFFFF0000) \ &H10000) And &HFFFF&) End Function /////////////////////////////////////// Lastly, add Call Hook(yourgridsname.hwnd) to the bottom of Form_Load for each grid you want to capture the scroll event then compile and your mouse wheel will work. Happy programming.
fweeee said:Its funny that you should ask that now. After working on this issue off and on since my previous post (5+ months), I finally arrived at a solution last night. Its dissapointing that I had to spend so much time (I would guess days) to acheive what I beleive should be standard functionality (or at least a standard option). But as far as I'm concerned, I couldnt release the application the way it was - it would just casue to many problems.Anyway, enough with my rant, onto the solution. I created a class to do this, to save writing it in each form individually. declare an object varaible to store the value of the dropdown field:
Its funny that you should ask that now. After working on this issue off and on since my previous post (5+ months), I finally arrived at a solution last night. Its dissapointing that I had to spend so much time (I would guess days) to acheive what I beleive should be standard functionality (or at least a standard option). But as far as I'm concerned, I couldnt release the application the way it was - it would just casue to many problems.
Anyway, enough with my rant, onto the solution. I created a class to do this, to save writing it in each form individually.
declare an object varaible to store the value of the dropdown field:
Thank you for sharing your solution, you saved me a lot of time :-)
Now, I'll share my version of this solution.I'm a VB developer, so i converted your solution in VB (and then, reconverted in C# using .Net Reflector ;-).I've fixed 2 issue:
*) in the dropdown close-up event, the value is still the old one; to get the right value we need to look something likeMe.mUGrid.ActiveCell.ValueListResolved.GetValue(Me.mUGrid.ActiveCell.ValueListResolved.SelectedItemIndex)
*) I've added a KeyUp event handler to track the value change due to user keyboard interaction with the UDD control
The VB version works, I've converted it in C# using .Net reflector, I don't know if it works, but at least it compile :-)
------------------------------------------------------------------
VB version
Imports Infragistics.Win.UltraWinGridImports System.Windows.FormsPublic Class UltraGridUddMouseWheelHack Public mUgrid As UltraGrid Private mUddSavedValueForMouseWheelHack As Object Public Sub InigUltraGridUddMouseWheelHack() AddHandler Me.mUgrid.ControlAdded, AddressOf Me.mUGrid_ControlAdded End Sub Private Sub mUGrid_ControlAdded(ByVal sender As Object, ByVal e As ControlEventArgs) 'Dim contType As String = sender.GetType().ToString() Dim uGrid As UltraGrid = DirectCast(sender, UltraGrid) Dim udd As UltraDropDown = TryCast(uGrid.ActiveCell.ValueListResolved, UltraDropDown) If (udd IsNot Nothing) Then AddHandler e.Control.MouseWheel, AddressOf mUGrid_uddControl_MouseWheel AddHandler e.Control.KeyUp, AddressOf mUGrid_uddControl_KeyUp AddHandler e.Control.Enter, AddressOf mUGrid_uddControl_Enter AddHandler udd.AfterCloseUp, AddressOf mUGrid_uddControl_AfterCloseUp End If End Sub Private Sub SaveUltraDropDownSelectedValue() '_dropdownValue = Me.mUGrid.ActiveCell.Value 'this one is wrong, when dthe dropdown close up, the activecell.value is still the old value; the grid update it later; so we need to picku up the corret value somwhere else (see down) If Me.mUgrid.ActiveCell IsNot Nothing AndAlso Me.mUgrid.ActiveCell.ValueListResolved IsNot Nothing Then mUddSavedValueForMouseWheelHack = Me.mUgrid.ActiveCell.ValueListResolved.GetValue(Me.mUgrid.ActiveCell.ValueListResolved.SelectedItemIndex) End If End Sub Private Sub mUGrid_uddControl_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) 'this tack the value change due to keyboard interaction SaveUltraDropDownSelectedValue() End Sub Private Sub mUGrid_uddControl_AfterCloseUp(ByVal sender As Object, ByVal e As DropDownEventArgs) 'this tack the selected value on dropdown close-up SaveUltraDropDownSelectedValue() End Sub Private Sub mUGrid_uddControl_Enter(ByVal sender As Object, ByVal e As EventArgs) 'save the current value, used in case the user don't change the current value, but still use the mouse wheel Dim senderControl As Control = DirectCast(sender, Control) Dim uGrid As UltraGrid = TryCast(senderControl.Parent, UltraGrid) If (uGrid IsNot Nothing) Then Dim dropdown As UltraDropDown = TryCast(uGrid.ActiveCell.ValueListResolved, UltraDropDown) If (dropdown IsNot Nothing) Then mUddSavedValueForMouseWheelHack = uGrid.ActiveCell.Value End If End If End Sub Private Sub mUGrid_uddControl_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs) Dim conSender As Control = DirectCast(sender, Control) Dim ugSender As UltraGrid = DirectCast(conSender.Parent, UltraGrid) If (ugSender IsNot Nothing) Then Dim dropdown As UltraDropDown = TryCast(ugSender.ActiveCell.ValueListResolved, UltraDropDown) If (dropdown IsNot Nothing) AndAlso (Not dropdown.IsDroppedDown) Then 'we need to restore the saved value because when this event handler is called, the 'udd current value has ALREADY been changed by this event, and this is exactly what mustn't happen ugSender.ActiveCell.Value = mUddSavedValueForMouseWheelHack 'from now-on, the mouse wheel will scroll the grid :-) ugSender.PerformAction(UltraGridAction.ExitEditMode, False, False) End If End If End SubEnd Class
C# version
using Infragistics.Win.UltraWinGrid;using System.Windows.Forms;using System;public class UltraGridUddMouseWheelHack{ private object mUddSavedValueForMouseWheelHack; public UltraGrid mUgrid; public void InigUltraGridUddMouseWheelHack() { this.mUgrid.ControlAdded += new ControlEventHandler(this.mUGrid_ControlAdded); } private void mUGrid_ControlAdded(object sender, ControlEventArgs e) { UltraGrid uGrid = (UltraGrid) sender; UltraDropDown udd = uGrid.ActiveCell.ValueListResolved as UltraDropDown; if (udd != null) { e.Control.MouseWheel += new MouseEventHandler(this.mUGrid_uddControl_MouseWheel); e.Control.KeyUp += new KeyEventHandler(this.mUGrid_uddControl_KeyUp); e.Control.Enter += new EventHandler(this.mUGrid_uddControl_Enter); udd.AfterCloseUp += new DropDownEventHandler(this.mUGrid_uddControl_AfterCloseUp); } } private void mUGrid_uddControl_AfterCloseUp(object sender, DropDownEventArgs e) { this.SaveUltraDropDownSelectedValue(); } private void mUGrid_uddControl_Enter(object sender, EventArgs e) { Control senderControl = (Control) sender; UltraGrid uGrid = senderControl.Parent as UltraGrid; if (uGrid != null) { UltraDropDown dropdown = uGrid.ActiveCell.ValueListResolved as UltraDropDown; if (dropdown != null) { this.mUddSavedValueForMouseWheelHack = uGrid.ActiveCell.Value; } } } private void mUGrid_uddControl_KeyUp(object sender, KeyEventArgs e) { this.SaveUltraDropDownSelectedValue(); } private void mUGrid_uddControl_MouseWheel(object sender, MouseEventArgs e) { Control conSender = (Control) sender; UltraGrid ugSender = (UltraGrid) conSender.Parent; if (ugSender != null) { UltraDropDown dropdown = ugSender.ActiveCell.ValueListResolved as UltraDropDown; if ((dropdown != null) && (!dropdown.IsDroppedDown)) { ugSender.ActiveCell.Value = this.mUddSavedValueForMouseWheelHack; ugSender.PerformAction(UltraGridAction.ExitEditMode, false, false); } } } private void SaveUltraDropDownSelectedValue() { if ((this.mUgrid.ActiveCell != null) && (this.mUgrid.ActiveCell.ValueListResolved != null)) { this.mUddSavedValueForMouseWheelHack = this.mUgrid.ActiveCell.ValueListResolved.GetValue(this.mUgrid.ActiveCell.ValueListResolved.SelectedItemIndex); } }}
Did you Submit a feature request to Infragistics?