Wpf

amitairoa

Newcomer
Joined
Jul 16, 2008
Messages
21
Hi!
I'm working on a WPF program in C#. I'm still a bit new to WPF.
I wanted to know how to set a control's position(image for instance)- from code. There isn't a "img.left" in WPF. I don't know how to control an image's position by code. Can someone please help me?
Thanks!
 
No absolute positioning in WPF

There is no absolute positioning in WPF. Instead, controls are automatically placed and sized according to their margins, the margins of adjacent controls, and the padding of their container. The system is very similar to that used in web pages.

Good luck :cool:
 
Re: No absolute positioning in WPF

There is no absolute positioning in WPF. Instead, controls are automatically placed and sized according to their margins, the margins of adjacent controls, and the padding of their container. The system is very similar to that used in web pages.

Good luck :cool:

I'm still new to WPF- can you please help me? How do I do this: I want an image to be at a certain point on the screen- which it is already. Then- at a timer tick- I want the image to move to a different location. Maybe you could please explain a bit more about the WPF positioning?
Thanks!
 
It really depends on exactly what you want to do as which method may be best, are you using the timer to drive some animation or is it being used for some other reason?

SetLeft and SetTop (methods of the Canvas object) will certainly give you control over the position of a visible element however if you are looking at just doing animation then WPF has a pretty sophisticated system built in that may better suit your needs.

Out of curiosity could you give a bit more detail about what you are trying to do?
 
It really depends on exactly what you want to do as which method may be best, are you using the timer to drive some animation or is it being used for some other reason?

SetLeft and SetTop (methods of the Canvas object) will certainly give you control over the position of a visible element however if you are looking at just doing animation then WPF has a pretty sophisticated system built in that may better suit your needs.

Out of curiosity could you give a bit more detail about what you are trying to do?

Hi!
The timer doesn't drive an animation. The timer just changes an image into a certain picture. It's basically a program for teaching something to kids.
 
Could you not just simply load the image into the control at runtime rather than changing it's position?

No. There's an audio file, and when the speaker says something- a different image appears. At one point- I want tthe image to be at a different position.
 
Back
Top