Hi,
I want to highlight the row on dragover where I am dropping an item from the grid. I have two different gridviews. I drag a row from one grid and drop on to other grid row,
I have written following code for Highlighting a gridviewrow on a Item dragover,
public T4ShipmentSchedulerView(IT4ShipmentSchedulerViewModel viewModel)
{
InitializeComponent();
StyleManager.SetTheme(ShipmentGrid, new OWBTheme());
DataContext = viewModel;
viewModel.GridOperations = new TelerikGridOperations(ShipmentGrid, Constants.T4ShipmentBuilderGridSettings);
//ShipmentGrid.RowLoaded += ShipmentGrid_RowLoaded;
}
private void ShipmentGrid_RowLoaded(object sender, RowLoadedEventArgs e)
{
GridViewRow row = e.Row as GridViewRow;
if (row == null) return;
DragDropManager.RemoveDragEnterHandler(row, OnRowDragOver);
DragDropManager.AddDragEnterHandler(row, OnRowDragOver);
DragDropManager.RemoveDragLeaveHandler(row, OnRowDragLeave);
DragDropManager.AddDragLeaveHandler(row, OnRowDragLeave);
DragDropManager.RemovePreviewDropHandler(row, OnPreviewDropLeave);
DragDropManager.AddPreviewDropHandler(row, OnPreviewDropLeave);
}
private void OnPreviewDropLeave(object sender, DragEventArgs e)
{
OnRowDragLeave(sender, e);
}
private void OnRowDragLeave(object sender, DragEventArgs e)
{
GridViewRow row = sender as GridViewRow;
if (row != null)
{
row.Background = _backGround;
row.Foreground = _foreGround;
}
}
Brush _backGround;
Brush _foreGround ;
private void OnRowDragOver(object sender, DragEventArgs e)
{
GridViewRow row = sender as GridViewRow;
if (row != null)
{
_backGround = row.Background;
_foreGround = row.Foreground;
row.Background = new SolidColorBrush(Colors.Gold);
row.Foreground = new SolidColorBrush(Colors.Black);
}
}
It highlights the row on drag over but it messes with other trigger styles and they stop working. Do we have more proper soln on this.
Regards,
Vidyadhar