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 118333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:28:41+00:00 2026-05-11T03:28:41+00:00

I would like to create a visual effect when an item in a listbox

  • 0

I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, however I am not able to leave the items control. Is there any way to remove the item from the ListBox and visually animate it to another location? Basically the main list box is a hand of cards. When a card is double-clicked I want it to visually move from the hand listbox to a discard listbox. As of now, the logic for moving the item from one collection to another is no problem, however I would really like an animated visual representation of this event. Any ideas or references on how to do something like this would be appreciated.

Thanks, Brandon

Further Details on what I have attempted: There are some concepts that I do not yet have a strong grasp of yet, which has led me to run face first into this wall. I have a method that I pass in(some may be unnecessary) the ListBox as an ItemsControl, a FrameworkElement that is the listbox item, and the data object associated with the ListBox item. What I attempted to do was FindVisualChild of the ListBoxItem that is a canvas. I can do that. In my mind I was wanting to somehow clone the canvas either as a canvas or as a bitmap, add it to the children of the child of the page in the same location, remove the ListBoxItem from the ListBox, and animate the clone to the discard pile. When the animation completes the clone will be removed or hidden, and as that object is added to the discard pile collection it will effectively take the replace the clone.

My problem with this, is that I feel like there really is a simpler way of doing this using the adorner layer or something. I also, don’t know how I would position the clone at the exact same position in the element further up the visual tree. I am going to keep working on it and researching other approaches, and I will just hope that someone will share some insight on this.

  • 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. 2026-05-11T03:28:42+00:00Added an answer on May 11, 2026 at 3:28 am

    Here’s some code I worked up to draw a visual to a bitmap. You may be able to adapt this to your needs, and draw the bitmap by adorning the UIElement that represents a common ancestor of the two list views. Note the use of FrameworkElement.TransformToAncestor to get the coordinates of a nested element in terms of an ancestor element.

            public static BitmapSource CreateBitmapFromElement(FrameworkElement element, Double dpiX, Double dpiY)         {             Size elementSize = new Size(element.ActualWidth, element.ActualHeight);             Visual root = GetAdornerDecoratorAncestor(element);             Rect elementBounds  = element.TransformToAncestor(root).TransformBounds(new Rect(elementSize));              RenderTargetBitmap rtb = new RenderTargetBitmap((Int32)(elementBounds.Size.Width * dpiX / 96.0),                                            (Int32)(elementBounds.Size.Height * dpiY / 96.0),                                            dpiX,                                            dpiY,                                            PixelFormats.Pbgra32);              DrawingVisual dv = new DrawingVisual();             using (DrawingContext dc = dv.RenderOpen())             {                 VisualBrush vb = new VisualBrush(root);                 vb.ViewboxUnits = BrushMappingMode.Absolute;                 vb.Stretch = Stretch.None;                 vb.Viewbox = elementBounds;                 dc.DrawRectangle(vb, null, new Rect(new Point(), elementBounds.Size));             }             rtb.Render(dv);             return rtb;         }          public static Visual GetAdornerDecoratorAncestor(DependencyObject obj)         {                         while(obj != null && !(obj is AdornerDecorator))             {                 obj = VisualTreeHelper.GetParent(obj);             }             return obj as AdornerDecorator;         } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I haven't tested this code out, but I suspect your… May 11, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer It's not going to be terribly easy... but here might… May 11, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer primitive types means different things in different languages and different… May 11, 2026 at 11:33 pm

Related Questions

When I use Build->Publish Web Site in Visual Studio 2008, most of the time
I am in a situation where I would like to accept a LOT of
I have a visual component that I built from a TFrame (but then registered
I have created a custom list in a SharePoint site and generated a Visual

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.