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

  • Home
  • SEARCH
  • 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 6971517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:51:00+00:00 2026-05-27T16:51:00+00:00

A stackpanel’s dragOver event gives me access to the stackpanel as sender, but how

  • 0

A stackpanel’s dragOver event gives me access to the stackpanel as sender, but how can I get the name of the listbox that the stackpanel is in (stack panel is defined in the datatemplate). The reason for this is to ultimately access all of the other stackpanels in the list generated by the datatemplate so if I’m barking up the wrong tree here I’ll appreciate an alternative way of accessing the other stackpanels. Thanks,

Dan.

  • 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-05-27T16:51:01+00:00Added an answer on May 27, 2026 at 4:51 pm

    Updated (working) answer

    You need to walk up the visual tree with VisualTreeHelper.GetParent on the StackPanel, and if necessary recurse over further parents, until you find the ListBox (use the as or is operator to detect that you have found it).

    For added convenience, or if you need to traverse the tree in other directions (which is a bit more involved), you can use a wrapper that exposes the traversal in a LINQy format such as this one.

    All this said, you might also want to take a look at How can I find WPF controls by name or type?.

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

Sidebar

Related Questions

I have a ListBox with a StackPanel that contains an image and label. <ListBox.ItemsPanel>
I have a listbox under stackpanel and vertical scrollbar is visible but the scroller
What can a DockPanel do that a StackPanel cannot? If anyone has an image
<StackPanel Grid.Column=0 > <Button Name=buttonEditListBoxItem Content=Edit Click=buttonEditListBoxItem_Click></Button> <ListBox Name=ListBoxTriggers SelectedValuePath=TriggerId IsSynchronizedWithCurrentItem=True SelectionChanged=Triggers_SelectionChanged ScrollViewer.HorizontalScrollBarVisibility=Auto HorizontalContentAlignment=Stretch>
I have a StackPanel and for some reason I can't get the content of
Right now I have a Stackpanel, that contains a collapsed Expander, and a Listbox.
I have a vertical StackPanel with two elements: a Button and a ListBox. How
I have a Stackpanel and want that the items automatically set their sizes regarding
I have a StackPanel inside of a ScrollViewer. I have a slider that does
I have a stackpanel with some usercontrols that are added or removed during runtime.

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.