Skip to main content
All docs
V25.1
  • DxHtmlPainterContext.OnMouseMove(MouseEventArgs, Object) Method

    Transfers the MouseMove mouse event to the target HTML element. This allows the element to change its visual state from “normal” to “hovered”.

    Namespace: DevExpress.Utils.Html

    Assembly: DevExpress.Utils.v25.1.dll

    NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

    Declaration

    public void OnMouseMove(
        MouseEventArgs e,
        object interactivityKey = null
    )

    Parameters

    Name Type Description
    e MouseEventArgs

    The EventArgs object utilized by the origin MouseMove event (the MouseMove event of the parent control).

    Optional Parameters

    Name Type Default Description
    interactivityKey Object null

    The ID that allows you to identify the specific instance of a custom-drawn template.

    Remarks

    The code below illustrates how to paint instances of the same HTML template inside Data Grid row preview areas, and assign unique IDs to all of these instances. The control’s MouseMove event is handled to identify the specific template instance of a template, and transmit this mouse event to this instance.

    DxHtmlPainterContext ctx = new DxHtmlPainterContext();
    
    gridView.CustomDrawRowPreview += (s, e) => {
        // Use a data source row index as a template instance ID
        int index = (s as GridView).GetDataSourceRowIndex(e.RowHandle);
        e.DrawHtml(htmlTemplate, ctx, (args) => args.InteractivityKey = index);
        e.Handled = true;
    };
    
    gridView.MouseMove += (s, e) => {
        GridView view = s as GridView;
        GridHitInfo hitInfo = view.CalcHitInfo(e.Location);
        if(hitInfo.RowHandle >= 0) {
            int index = view.GetDataSourceRowIndex(hitInfo.RowHandle);
            // Use the same interaction key value to find the correct template
            ctx.OnMouseMove(e, index);
            view.GridControl.Cursor = ctx.GetCursor(e.Location, index);
            view.InvalidateRow(hitInfo.RowHandle);
        }
    };
    

    See this article to learn more about transmitting mouse events from parent controls to HTML template instances: Custom Draw Templates.

    See Also