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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:44:18+00:00 2026-05-26T19:44:18+00:00

<ListBox Name=listBoxButtons Height=700> <ListBox.ItemTemplate> <DataTemplate> <Border Background={StaticResource PhoneAccentBrush} Name=border Width=432 Height=62 Margin=6 Padding=12,0,0,6> <TextBlock

  • 0
<ListBox Name="listBoxButtons"
         Height="700">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Border Background="{StaticResource PhoneAccentBrush}"
                    Name="border"
                    Width="432" Height="62"
                    Margin="6" Padding="12,0,0,6">
                <TextBlock Text="{Binding}" 
                           Foreground="#FFFFFF" FontSize="26.667"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Bottom"
                           FontFamily="{StaticResource PhoneFontFamilySemiBold}"/>
                <Border.Projection>
                    <PlaneProjection RotationX="-60"/>
                </Border.Projection>
            </Border>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Code:

private void ShowAnim()
{
    IEasingFunction quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut };
    Storyboard _swivelShow = new Storyboard();
    foreach (var item in this.listBoxButtons.Items)
    {
        UIElement container = listBoxButtons.ItemContainerGenerator.ContainerFromItem(item) as UIElement;
        if (container != null)
        {
            Border content = VisualTreeHelper.GetChild(container, 0) as Border;
            if (content != null)
            {
                DoubleAnimationUsingKeyFrames showAnimation = new DoubleAnimationUsingKeyFrames();

                EasingDoubleKeyFrame showKeyFrame1 = new EasingDoubleKeyFrame();
                showKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0);
                showKeyFrame1.Value = -60;
                showKeyFrame1.EasingFunction = quadraticEase;

                EasingDoubleKeyFrame showKeyFrame2 = new EasingDoubleKeyFrame();
                showKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(85);
                showKeyFrame2.Value = 0;
                showKeyFrame2.EasingFunction = quadraticEase;

                showAnimation.KeyFrames.Add(showKeyFrame1);
                showAnimation.KeyFrames.Add(showKeyFrame2);

                Storyboard.SetTargetProperty(showAnimation, new PropertyPath(PlaneProjection.RotationXProperty));
                Storyboard.SetTarget(showAnimation, content.Projection);

                _swivelShow.Children.Add(showAnimation);
            }
        }
    }
    _swivelShow.Begin();
}

But: Storyboard.SetTarget(showAnimation, content.Projection) throws an Exception. The content.Projection is null. How could that happen?

  • 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-26T19:44:18+00:00Added an answer on May 26, 2026 at 7:44 pm

    You are looking at the wrong Border element. The hierarchy of the item container in your case is like Border -> ContentControl -> ContentPresenter -> Border (this is yours). So you have to go deeper down the child hierarchy of your container to find the border you want.

    The following code searches the children of an UIElement recursively and gives some debug output so you can see how deep it goes. It will stop when it finds a control named “border”:

        private UIElement GetMyBorder(UIElement container)
        {
            if (container is FrameworkElement && ((FrameworkElement)container).Name == "border")
                return container;
    
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(container); i++)
            {
                var child = (FrameworkElement)VisualTreeHelper.GetChild(container, i);
                System.Diagnostics.Debug.WriteLine("Found child "+ child.ToString());
    
                System.Diagnostics.Debug.WriteLine("Going one level deeper...");
                UIElement foundElement = GetMyBorder(child);
                if (foundElement != null)
                    return foundElement;
            }
            return null;
        }
    

    To use it:

        Border content = (Border)GetMyBorder(container);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<ListBox Height=434 HorizontalAlignment=Left Margin=6,238,0,0 Name=listBox1 VerticalAlignment=Top Width=432 DataContext={Binding}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text={Binding Name}
I have the following XAML: ... <ListBox Name =RoomsListBox Height=100 HorizontalAlignment=Left Margin=12,41,0,0 VerticalAlignment=Top Width=120></ListBox>
my listbox: <ListBox x:Name=listBox Grid.Row=2 FontSize=26 SelectionChanged=listBox_SelectionChanged ItemsSource={Binding SelectedSubGenre.PhotoCollection}> <ListBox.ItemTemplate> <DataTemplate> <Border BorderBrush=BurlyWood BorderThickness=1,1,1,1
I have xaml that lookes like this <ListBox> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text={Binding Name}
A have listbox <ListBox> <ListBox.ItemTemplate> <DataTemplate> <DockPanel> <Button Content={Binding name_trainer} Tag={Binding idPersonTrainer} DockPanel.Dock=Top HorizontalAlignment=Center>
I have a ListBox that uses a custom control as the ListBox.ItemTemplate DataTemplate. I
I have a listbox defined in XAML as: <ListBox x:Name=directoryList MinHeight=100 Grid.Row=0 ItemsSource={Binding Path=SelectedDirectories}/>
By default the listbox in ASP.NET has a 3D border effect. I need to
I have a ListBox with an ItemTemplate consisting of a TextBlock and a ComboBox
I have a loop that takes file name from a listbox, performs a system()

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.