0

there is a Line control which we can define like this:

<Line X1="10" Y1="30" X2="100" Y2="100" Stroke="Red" />

I'd like to create a point object of which i could define like this

<my:Point X="12" Y="44" Fill="Red" />

the whole point of this is that i could avoid calling Canvas.Top and Canvas.Left methods anyone have any ideas?

RoKK
  • 617
  • 8
  • 17

1 Answers1

0

If there is a Point class in the namespace referred to by the XML namespace my, and it has settable properties named X, Y and Fill of a compatible type, then instantiating an object in XAML is as simple as your example.

Of course you may need to convert from the string "Red" to a Brush, but that's easy.

The more interesting question is how exactly do you want to use that object?

Community
  • 1
  • 1
Jon
  • 428,835
  • 81
  • 738
  • 806