Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Position of UIElement

Position of UIElement

Scheduled Pinned Locked Moved WPF
questionwinformstutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sadas232341s
    wrote on last edited by
    #1

    In Windows Forms, when I set the position of an UIElement I do it that way:

    UIElement.Location = new Point(X, Y);

    // then I get it with

    UIElement.Location.X
    UIElement.Location.Y

    How can I do this simple task in Silverlight, for example with canvas, called "MyCanvas";

    // This doesn' t work.

    MyCanvas.Margin.Left
    MyCanvas.Margin.Top

    What is this Margin about?

    M 1 Reply Last reply
    0
    • S sadas232341s

      In Windows Forms, when I set the position of an UIElement I do it that way:

      UIElement.Location = new Point(X, Y);

      // then I get it with

      UIElement.Location.X
      UIElement.Location.Y

      How can I do this simple task in Silverlight, for example with canvas, called "MyCanvas";

      // This doesn' t work.

      MyCanvas.Margin.Left
      MyCanvas.Margin.Top

      What is this Margin about?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      TCPMem wrote:

      What is this Margin about?

      From the docs: "The margin is the space between this object and other objects that will be adjacent when layout creates the UI." There's a variety of ways to layout elements in Silverlight/WPF beyond simple XY coordinates. There are elements that layout their child elements, and there are elements that layout based on their child elements. Maybe at least glossing over the documentation will help in understanding at least the basics of layout in Silverlight. There's Silverlight documentation available both online[^] and offline[^].

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups