How to prevent selection change in drop down from key press when UltraComboEditor’s DropdownStyle set to DropDownList?

Scenario:
Current requirement is that user can select option from drop down from mouse selection only, but whenever use type anything in the drop down it automatically raise control’s ComboBox.SelectionChangeCommitted event with first match that satisfies auto complete condition of the control. As required we need
ignore the key press to raise the ComboBox.SelectionChangeCommitted event of the combo box and it only allow selection only on mouse.

Solution:

 

To do this, I set the control’s DropdownStyle set to DropDownList, but no work correctly. Along this I have to suppress combo box’s key press by handling KeyDown event as below.

LibraryListDropdown libDropdown = null;
public Form1()
{
    InitializeComponent();
    libDropdown = new LibraryListDropdown();
    this.libDropdown.DropDownStyle = DropDownStyle.DropDownList;
    libDropdown.Name = "cmbObjectType";
    libDropdown.SelectionChangeCommitted += new EventHandler(libDropdown_SelectionChangeCommitted);
    libDropdown.KeyDown += libDropdown_KeyDown;
    this.Controls.Add(libDropdown);
    libDropdown.PopulateLibraries();
}

void libDropdown_KeyDown(object sender, KeyEventArgs e)
{
    e.SuppressKeyPress = true;
}

private void libDropdown_SelectionChangeCommitted(object sender, EventArgs e)
{
    
}

How to display tooltip on mouse hover in particular cell or column cell?

Scenario:  

Today I got an assignment to display tooltip on particular column cell depending on its text that contain some specific prefix to create different tool tip text.  The grid control was used is Infragistics UltraWinGrid to populate data to user.

Solution/Description:

Most of the time I work with DevExpress controls and default win form controls, there we have different approach to get the grid element when hovering mouse over the grid element.  These controls use HitTestInfo to determine that which grid element currently hovered. While looking for the solution I found one Stackoverflow thread - DataGridView.HitTestInfo equivalent in Infragistics UltraWinGrid? . I am also hunting for the same question’s answer that does Infragistics’s UltraGrid control provides functionality similar to that of DataGridView.HitTestInfo?

Source - Task-based Tutorial - How to use ToolTips with the Infragistics UltraWinGrid

 I found out that Infragistics controls don't convert the coordinates, but they use a special Infragistics grid event (MouseEnterElement) to get the element, which the mouse currently hovers over. Also with the Infragistics UltraWinGrid-control it required to keep track of the grid-row, over which the cursor is hovering. In contrast to our generic solution, the position is stored in a data-type provided by the UltraWinGrid-control and not in a Point-structure: 

Public Class Form1
    Inherits System.Windows.Forms.Form 
   ...  
    'Holds the row/column-coordinates of the cell on which
    'the mouse is hovering...
    Private mCurrentCell As Infragistics.Win _ 
                .UltraWinGrid.UltraGridCell = Nothing
  ...

The way of implement for the generic grid-control (in the section on "How to use ToolTips with grid-controls"), the whole logic, to keep track of the current mouse-position in terms of grid-coordinates (row/column) and to provide the tooltip with the content of the current grid-element, is located in the MouseEnterMouseLeave and MouseMove event-handlers. This is slightly different for the UltraWinGrid-control. Of course, the needed logic is also coupled to mouse-events, but the UltraWinGrid-control provides additional mouse-related events, which make the integration even easier. 

 

Code snippet to show tooltip while using UltraWinGrid:

private void ultraGrid1_MouseEnterElement(object sender, UIElementEventArgs e)
{
    if (e.Element is RowUIElement)
    {
        if (e.Element.SelectableItem is UltraGridRow)
        {
            UltraGridRow ultraGridRow = (UltraGridRow)e.Element.SelectableItem;

            if (ultraGridRow.Band.Key == PaletteZoneHVACGroupingConstants.BAND_PARENT)
            {
                toolTip.ToolTipText = "Drag-n-drop here";
                toolTip.Show();
            }
        }                
    }
    else if(e.Element is CellUIElement)
    {
        // Get a refernce to the column.
        UltraGridColumn column = (UltraGridColumn)e.Element.GetContext();
        if (column != null && column.Key == ColumnName.DESIGNTEMPLATE)
        {
            UltraGridCell cell = e.Element.SelectableItem as UltraGridCell;
            if (cell.Row.Band.Key == Constants.BAND_PARENT)
            {
                string toolTipMessage = string.Empty;
                if (cell.Text.StartsWith(Constants.TextDesginChangePrefix))
                {
                    toolTipMessage = ResourceMessage.GetMessage(ResourceConstants. DESGINS_CHANGE);
                }
                else if (cell.Text.StartsWith(Constants.TextParametersChangePrefix))
                {
                    toolTipMessage = ResourceMessage.GetMessage(ResourceConstants.DESGINS_PARAMETERS_CHANGE);
                }
                
                if (!string.IsNullOrWhiteSpace(toolTipMessage))
                {
                    toolTip.ToolTipText = toolTipMessage;
                    toolTip.Show();
                }
            }
        }
    }
}

private void ultraGrid1_MouseLeaveElement(object sender, UIElementEventArgs e)
{
    toolTip.Hide();
}

 

References:

How to set UltraToolTipeInfo in perticular row in win ultra grid control.

display tooltip on mouse hover in cell