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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:42:34+00:00 2026-05-23T21:42:34+00:00

I am trying to draw a simple line in WP7 XAML such as the

  • 0

I am trying to draw a simple line in WP7 XAML such as the one below. With static coordinate values this works fine.

<Line Stroke="White" 
      X1="1" Y1="1" 
      X2="200" Y2="1" />

What I need is to bind the coordinate values relative to other controls on the same Canvas based on a matching property value such as its Id or Name. Once the correct control is bound, I need to get its Left and/or Top Canvas locations. Using a vague pseudocode, here is what I would like to be able to do…

<Line Stroke="White" 
      X1="{Binding Canvas.Left, Source={Binding <a_control_where_a_property_equals_some_value>}}" Y1="1" 
      X2="200" Y2="1" />

I’ve tried a number of binding scenarios with no success. The extra complexity is that this is Windows Phone 7 (WP7) binding and not full blown XAML.

Note: All the controls are added at runtime so they are not statically defined.

Any Suggestions???

  • 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-23T21:42:35+00:00Added an answer on May 23, 2026 at 9:42 pm

    The best you can hope for is to use ElementName. Other than that, you’d need to expose a common property somewhere that both controls would be bound to. Possibly in a view-model, but it depends on your setup.

    Sample of ElementName:

    <Canvas>
        <Line x:Name="line1" Stroke="White" X1="1" Y1="1"  X2="200" Y2="1" />
        <Line Stroke="White" X1="{Binding ElementName=line1, Path=X1}" Y1="10"  X2="200" Y2="1" />
    </Canvas>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw a simple line graph which would use values from the
I am trying to draw a simple line in html5 and noticed the following
I'm trying to draw simple 2d things in my JSP application. I found this
This is probably a simple thing. I'm trying to draw my first shapes in
I'm trying to just draw a simple image from the drawable-mdpi folder in android
I'm trying to make a simple applet where you can draw simple shapes (the
Currently I'm trying to do what I thought would be a simple task: Draw
I'm trying to draw a simple box in my iPhone game. Here is the
So I'm trying to draw a simple rectangle in my iOS cocos2d game, but
I am trying to make a simple line drawing program in java, I am

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.