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

The Archive Base Latest Questions

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

My environment is windows phone 7.1. I have the following code: <ListBox ItemsSource="{Binding Path=Items}">

  • 0

My environment is windows phone 7.1.

I have the following code:

     <ListBox  ItemsSource="{Binding Path=Items}">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas Background="Black" />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Canvas  Width="200" Height="400"
                    Canvas.Top="400"> <====== This is not working
                   ... Some content ...
                </Canvas>
            </DataTemplate>
        </ListBox.ItemTemplate>

There is a ListBox that has a Canvas as ItemsPanel.

The ListBoxItems itself are also of type Canvas. For the ListBoxItems I set Canvas.Top =400, i expect the items to show with an offset of 400 in the ItemsPanel.

Unfortunately this doesn’t work, the items are rendered at an offset of 0 as shown in this image (the ItemsPanel is black, the colorful rectangle is a listitem):

enter image description here

Why arent the ListBoxItems rendered at an offset of 400?

  • 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:23:06+00:00Added an answer on May 27, 2026 at 4:23 pm

    You are setting the Canvas.Top on the contents of the ListBoxItems not the actual items

    When using a canvas as item panel you have to remember that your datatemplated objects are wrapped in ListboxItems

    ListBox
      Canvas <- your itemtemplate
        ListBoxItem
          Canvas <- your datatemplate
    

    solution:

    <ListBox.ItemContainerStyle>
      <Style TargetType="ListBoxItem">
         <Setter Property="Canvas.Top" Value="400"/>
      </Style>
    </ListBox.ItemContainerStyle>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have test this code on my development environment (windows 7, visual studio 2010)
I have the following environment: Windows 7 Ultimate 64-bit MS office (with Access) 2010
I'm writing a windows phone 7 app. I have fatal exception handling code where
I work in a Windows environment and would prefer to deploy code to IIS.
What Windows Phone 7 demo/reference applications have you seen which really made you interested
I have a SQL Server 2008 in production environment (Windows 2003 -64 bit) and
I would like my Windows Phone application to access an environment variable of the
Environment: Windows 7 SP1 Visual Studio 2010 Ultimate SP1 .NET 4.0 I have a
Environment: Windows XP. Visual Studios 2010. Language - C++. I have run into the
Environment: Windows Server 2003 R2 Enterprise 64bit, SP2 .NET framework is supposedly installed (2.0

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.