Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:10:07+00:00 2026-06-04T17:10:07+00:00

Okay guys, I have been scratching my head like mad over this issue and

  • 0

Okay guys, I have been scratching my head like mad over this issue and have spent a good few hours trying to research how it works but I am yet to find an answer, if you wish to see any of my SRC feel free to ask about it and I will see if I can help.

Basically the issue I am having is that I have a TreeView of folders in my application i.e.:

Catalog

  Brands
    Nike
    Adidas
    Lactose

  Styles
    Sandles
    Trainers
    Boots

The issue that I am trying to fix is that when I drag a folder around (This is handled in my DragDropManager class), I am unable to scroll up or down(simply displays a lovely stop sign). I am also unable to find a scroller actually within the TreeView, so I am unsure how it is being generated (This is not my own software, I have recently started working for a company so I am not familiar with the code and no one else seems to know.)

This is a problem if I want to move something from the very top to the very bottom.

The scrolling works fine on its own without the dragging being done.

If anyone wishes to see any part of my code feel free to ask as I am unsure what to actually show you guys.

I have read through a good few articles and am just left scratching my head.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:10:09+00:00Added an answer on June 4, 2026 at 5:10 pm

    I have created an attached property for achieving this behavior, have a look at my post here –

    Attached Behavior for auto scrolling containers while doing Drag & Drop

    Main logic is something like this –

    private static void OnContainerPreviewDragOver(object sender, DragEventArgs e)
    {
        FrameworkElement container = sender as FrameworkElement;
    
        if (container == null) { return; }
    
        ScrollViewer scrollViewer = GetFirstVisualChild<ScrollViewer>(container);
    
        if (scrollViewer == null) { return; }
    
        double tolerance = 60;
        double verticalPos = e.GetPosition(container).Y;
        double offset = 20;
    
        if (verticalPos < tolerance) // Top of visible list? 
        {
            //Scroll up
            scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - offset);
        }
        else if (verticalPos > container.ActualHeight - tolerance) //Bottom of visible list? 
        {
            //Scroll down
            scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + offset);     
        }
    }
    

    Similar questions on SO (although they are mostly for ListBox/ListView but should work for TreeView too) –

    WPF Listbox auto scroll while dragging

    WPF ListView Databound Drag/Drop Auto Scroll

    WPF Drag-to-scroll doesn't work correctly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, guys i have been trying to define a Stack , each node also
Okay guys, basically the problem I'm having is this. I've been assigned to write
Okay guys I have a database I have been working on for days now.
Hye guys. Okay. I have done this coding. But it seems have error. Can
Okay guys , so I have this algorithm that selects an option based on
Okay guys hopefully I can explain this effectively, so here goes. I have a
Okay this will be my last post here for today, have asked you guys
Okay I have spent the last 2 days trying to sort this one out.
Okay guys, I have read through all the other posts and question on jQuery
Okay, before you guys go nuts -- this is just a small site, temporary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.