How can I scroll a ScrollViewer while and only while a dragged file or control is over a specific droppable control? C# VisualStudio 2015 Community
Not the same questions as WPF - How could I get a scrollviewer control from my XAML file in C#?, though it does look like we are trying to do the same thing.
I can access my scrollviewer and I can use VerticalOffset to make it scroll. I just can't figure out how to keep it scrolling until the file or control being dragged is no longer over the control. I have tried several while loops, but have not yet found a condition that I could use to break it. Below is one such attempt.
Thank you, Eric
bool continueScroll = false; // global variable
private void Drag_Enter_Scroll_Down(object sender, DragEventArgs e)
{
continueScroll = true;
while (continueScroll)
{
imageScrollViewer.ScrollToVerticalOffset(imageScrollViewer.VerticalOffset + 0.1);
}
}
private void Drag_Leave_Scroll_Down(object sender, DragEventArgs e)
{
continueScroll = false;
}