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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:24:02+00:00 2026-05-18T00:24:02+00:00

I have a ListBox that uses a custom control as the ListBox.ItemTemplate DataTemplate. I

  • 0

I have a ListBox that uses a custom control as the ListBox.ItemTemplate DataTemplate.

I guess my first question (and the rest are relevant) is how to you create unique names for the children in a listbox?

I ask because I am attempting to invoke a ListBox.Resource Storyboard from codebehind. The error I am getting is that the MyShadow is not found.

<MyControl.BitmapEffect>
    <DropShadowBitmapEffect x:Name="MyShadow" ShadowDepth="5" Opacity="0.5" Softness="0.5" />
</MyControl.BitmapEffect>

My xaml storyboard is

<Storyboard x:Key="FocusedShadow">
    <!-- Shadow Animation-->
    <DoubleAnimation
         Storyboard.TargetName="MyShadow" 
         Storyboard.TargetProperty="ShadowDepth" 
         To="15" 
         Duration="0:0:.14"  />
 </Storyboard>

I think what I need to do is specify the Targetname as the name of the item (relating back to first question) and the TargetProperty should be MyShadow.Shadowdepth but I don’t know how to get there from here.

In code I am doing a storyboardobject.begin(this);

TIA

  • 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-18T00:24:03+00:00Added an answer on May 18, 2026 at 12:24 am

    I had a very similar problem. basically, (I am thinking) that you are trying to animate before the visual tree is fully created. I solved this by using two techniques.

    first, I Raise my animate event (which fires the Trigger in my xaml) inside of a Dispatcher.BeginInvoke(...), using a priority of ApplicationIdle (this way we are pretty sure the visual tree has been created) also, I am calling UpdateLayout() before I raise the event.

    second, I am accessing the object, like so: var child = this.GetTemplatedChild("MyCanvas") to ensure that the canvas is actually there before trying to raise my event. (not so sure this helped, but the exception went away after I added this)
    here is my sample code:

       this.Dispatcher.BeginInvoke(new Action(() =>
       {
          this.UpdateLayout();
          if (this.Visibility == System.Windows.Visibility.Visible)
          {
             var bzyCanvas = this.GetTemplateChild("BusyCanvas");
             if (bzyCanvas != null)
                this.RaiseEvent(new RoutedEventArgs(AnimationStarted));
          }
       }),System.Windows.Threading.DispatcherPriority.ApplicationIdle);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListBox that uses a WrapPanel for its ItemsPanel , a custom
I'm trying to create a layout that uses a ListBox and my custom header
I have a listbox that displays Shipment Items (custom class) that are formatted using
I have a wpf listbox that implements a DataTemplate that contains a TextBlock. <local:BooleanToFontColorConverter
I have a simple usercontrol that uses a simple custom panel where I just
I have a listbox that uses a UserControl as the item template. Inside the
I have a user control that inherits from the ListBox class and displays a
I have listbox in my WP7 that uses the below DataTemplete to display the
I am creating a timeline control that uses listbox to place my items on
I have a usercontrol that has a textbox and a listbox, and it uses

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.