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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:45:58+00:00 2026-05-17T01:45:58+00:00

I have a ObservableCollection<Class1> where Class1 contains x and y positions as properties. The

  • 0

I have a ObservableCollection<Class1> where Class1 contains x and y positions as properties. The list can be of any size. I have a ViewModel that exposes the collection as a property. In my view, I want to generate a list of elements based on the collection and then set their x and y positions based on the Class1 Object’s properties.

How can I do this? I know I can easily bind a collection control (like List View) to the Collection easily. But I need to bind it and the elements use the x, y property to position themselves on the canvas. Any ideas appreciated.

  • 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-17T01:45:59+00:00Added an answer on May 17, 2026 at 1:45 am

    You can use a Canvas as your ItemsPanel in the ItemsControl, and then bind the Canvas.Top and Canvas.Left properties on the ItemContainerStyle to the X and Y properties:

    <ItemsControl ItemsSource="{Binding}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
    
            <ItemsControl.ItemContainerStyle>
                <Style>
                    <Setter Property="Canvas.Left" Value="{Binding X}" />
                    <Setter Property="Canvas.Top" Value="{Binding Y}" />
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ObservableCollection<Object> that contains two different types. I want to bind this
I have a list of items of a custom class. That class contains an
I have a ViewModel which contains an ObservableCollection of booleans. And I have a
I have ViewModel class as follows: public class ListViewModel { public ObservableCollection<InfoItem> List {
I have an ObservableCollection that is created in user control that contains a custom
I have an object called TestData that contains two properties, a string and an
I have a list view which contains checkboxes. How I can get if it
I have a usercontrol bound to a VM. This VM contains a collection property,
I have a class ShipmentsCollection that inherits ObservableCollection which contains shipment objects (entities). This
I have property UserSet which contains from ObservableCollection<GridRow> . GridRow - my class, which

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.