Hello I have a grid with rows reordered I'm trying the method ScrollIndexIntoView, to make sure that the grid scroll while dragging a row.
The first time it works, the second no.
Post my code
The first time it works, the second no.
Post my code
private
void
OnDropInfo(
object
sender, DragDropEventArgs e)
{
if
(!(e.Options.Source
is
GridViewRow))
return
;
RadGridView gridView = sender
as
RadGridView;
uPlanning planningContainer = GetPlanningContainer(gridView);
planningContainer.pTimer.Enabled =
false
;
IList draggedItems = e.Options.Payload
as
IList;
TreeViewDragCue cue = e.Options.DragCue
as
TreeViewDragCue;
cue.DropPossibleIconTemplate =
null
;
cue.DropPossibleIcon =
null
;
cue.DropImpossibleIconTemplate =
null
;
cue.DropImpossibleIcon =
null
;
if
(e.Options.Status == DragStatus.DropPossible)
{
int
rowIndex = 0;
if
(draggedItems.Count > 0)
{
GridViewRow row =
this
.AssociatedObject.ItemContainerGenerator.ContainerFromItem(
this
.currentDropItem)
as
GridViewRow;
DropPosition pos =
this
.GetDropPositionFromPoint(e.Options.CurrentDragPoint, row);
//azzero template drag&drop
foreach
(GridViewRow gvr
in
gridView.ChildrenOfType<GridViewRow>())
gvr.BorderThickness =
new
Thickness(0, 0, 0, 0);
rowIndex = gridView.Items.IndexOf(
this
.currentDropItem) + 1;
#region Template drag&drop
switch
(pos.ToString())
{
case
(
"Before"
):
cue.DragActionContent = String.Format(
"Sposta prima di "
);
if
(row !=
null
)
{
row.BorderThickness =
new
Thickness(0, 5, 0, 0);
row.BorderBrush =
new
SolidColorBrush(Colors.White);
}
break
;
case
(
"After"
):
cue.DragActionContent = String.Format(
"Sposta dopo "
);
if
(row !=
null
)
{
row.BorderThickness =
new
Thickness(0, 0, 0, 5);
row.BorderBrush =
new
SolidColorBrush(Colors.White);
}
break
;
default
:
cue.DragActionContent = String.Format(
"Inserisci "
);
break
;
}
if
(currentDropItem !=
null
)
{
if
(currentDropItem
is
PROD_ORDINI)
cue.DragTooltipContent = (currentDropItem
as
PROD_ORDINI).opcliedes;
else
cue.DragTooltipContent = (currentDropItem
as
Cvt).cvtnumero;
cue.IsDropPossible =
false
;
if
(gridView.Tag.ToString() ==
"E"
&& draggedItems[0]
is
PROD_ORDINI)
{
//se sposto all'interno dei da pianificare
cue.DragActionContent =
null
;
cue.IsDropPossible =
true
;
}
if
(gridView.Tag.ToString() ==
"F"
&& draggedItems[0]
is
Cvt)
{
cue.DragTooltipContent =
null
;
cue.IsDropPossible =
true
;
}
}
#endregion
}
else
{
//azzero template drag&drop
foreach
(GridViewRow gvr
in
gridView.ChildrenOfType<GridViewRow>())
gvr.BorderThickness =
new
Thickness(0, 0, 0, 0);
}
gridView.ScrollIndexIntoView(rowIndex);
}
}