Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Identifying row while dropping an item to the ultrawingrid
posted

Hi,

I was trying to drag and drop from a ultralistview control to a ultragrid. While dropping an item I want to identify the Row or Cell at the point of dropping. If any one knows how to do it, please help me.

 

Thanks,

Joby

  • 69832
    Offline posted

    /// <summary>
    /// Returns the UltraGridRow at the spcified point, or null if there is none.
    /// </summary>
    /// <param name="grid">The UltraGrid</param>
    /// <param name="point">The location, relative to the grid's coordinate system.</param>
    /// <param name="cell">[out] A reference to the cell at the specified point, or null if there is none.</param>
    static private UltraGridRow RowFromPoint( UltraGrid grid, Point point, out UltraGridCell cell )
    {
        cell = null;

        UIElement controlElement = grid != null ? grid.DisplayLayout.UIElement : null;
        if ( controlElement == null )
            return null;

        UIElement element = controlElement.ElementFromPoint( point );
        UltraGridRow row = element != null ? element.GetContext( typeof(UltraGridRow) ) as UltraGridRow : null;           
        cell = element != null ? element.GetContext( typeof(UltraGridCell) ) as UltraGridCell : null;

        return row;           
    }