locked
could someone explain how come the canvas.top is not directly a property? RRS feed

  • Question

  • why it is not like in flash that we set something.x and something.y to locate the display object but using some outside mothed? isn't that easier to understand (and more convenient)?

    Sunday, August 15, 2010 1:48 AM

Answers

  • because silverlight is not flash, and flash is not silverlight.

    is it two different technologies.

    for set X and Y position of your object following below (from code behind):

    {YOUR_OBJECT_NAME}.SetValue(Canvas.LeftProperty, {YOUR_VALUE}); //X position

    {YOUR_OBJECT_NAME}.SetValue(Canvas.TopProperty, {YOUR_VALUE}); //Y position


    and answering your question:

    "could someone explain how come the canvas.top is not directly a property?"

    A: microsoft shows the correct policy programming using OOP.
    adobe shows policy ineptitude and engages in it its developers, who have you decide.
    I just had a flash-developer and tired, so was happy developer silverlight.

    Sunday, August 15, 2010 3:46 AM
  • X and Y are not direct properties because they only make sense when an object is in a Canvas, which supports direct positioning by coordinate. Canvases are actually not very popular panels. Much more popular are Grids and StackPanels, which position their children dynamically depending on their children's desired size, and so X and Y properties have no relevance here.

    That is why Microsoft chose to make positioning properties attached properties of the parent panel, not direct properties of the children themselves. 

    Sunday, August 15, 2010 3:57 AM
  • Do not forget that people can develop games, where necessary accommodation the Tile coordinates.

    Sunday, August 15, 2010 4:30 AM

All replies

  • because silverlight is not flash, and flash is not silverlight.

    is it two different technologies.

    for set X and Y position of your object following below (from code behind):

    {YOUR_OBJECT_NAME}.SetValue(Canvas.LeftProperty, {YOUR_VALUE}); //X position

    {YOUR_OBJECT_NAME}.SetValue(Canvas.TopProperty, {YOUR_VALUE}); //Y position


    and answering your question:

    "could someone explain how come the canvas.top is not directly a property?"

    A: microsoft shows the correct policy programming using OOP.
    adobe shows policy ineptitude and engages in it its developers, who have you decide.
    I just had a flash-developer and tired, so was happy developer silverlight.

    Sunday, August 15, 2010 3:46 AM
  • X and Y are not direct properties because they only make sense when an object is in a Canvas, which supports direct positioning by coordinate. Canvases are actually not very popular panels. Much more popular are Grids and StackPanels, which position their children dynamically depending on their children's desired size, and so X and Y properties have no relevance here.

    That is why Microsoft chose to make positioning properties attached properties of the parent panel, not direct properties of the children themselves. 

    Sunday, August 15, 2010 3:57 AM
  • Do not forget that people can develop games, where necessary accommodation the Tile coordinates.

    Sunday, August 15, 2010 4:30 AM
  • "X and Y are not direct properties because they only make sense when an object is in a Canvas"

    i think that's what i missed. thank you.

    Sunday, August 15, 2010 9:26 AM