Hi,
I have an issue with the following simple code where I drag a label over a GridView header. The DragDrop codes works fine.
I recently added the following ligne
SetLabelBorder(sourceLabel, true);
In the DynamicLabel_MouseDown event handler starting the DragDrop along with the DynamicLabel_MouseUp event handler.
The labelBorder is normally setup in the MouseDown event, but even if I simply click on the label and release it, the MouseUp event is not called and the border cannot be suppressed.
Here is the related code:
RadLabel? PreviousLabelWithBorderSet = null; private void DynamicLabel_MouseDown(object? sender, MouseEventArgs e) { sourceLabel = sender as RadLabel; if (sourceLabel != null) { if (e.Button != MouseButtons.Left) return; isCurrentlyDragging = true; objCurrentlyDragged = DragObject.Label; SetLabelBorder(sourceLabel, true); gvCsvData.DragDrop += gvCsvData_DragDrop; if (sourceLabel != null) DoDragDrop(sourceLabel.Text, DragDropEffects.Copy); } } private void DynamicLabel_MouseUp(object? sender, MouseEventArgs e) { sourceLabel = sender as RadLabel; if (sourceLabel != null) { if (e.Button != MouseButtons.Left) return; if (sourceLabel != null) SetLabelBorder(sourceLabel, false); } } private void SetLabelBorder(RadLabel labelBorder, bool setBorder) {
// Temporary : At least suppress previous label border if new one is selected !! if (PreviousLabelWithBorderSet != null) { PreviousLabelWithBorderSet.LabelElement.BorderVisible = false; PreviousLabelWithBorderSet = null; } if (setBorder) { labelBorder.LabelElement.BorderVisible = true; PreviousLabelWithBorderSet = labelBorder; } else { labelBorder.LabelElement.BorderVisible = false; } }
What am I doing wrong ?
Thanks
Patrick