Q:

WPF Canvas Create object

I am using WPF and C# and I have a canvas with rectangles on it (like a maze). Now i want to create a character who moves (with the help of an algorithm) through this maze. Therefore I created a new class called character, but my problem starts here: How do I create an object on the canvas which has an image, a position and which can access the methods and attributes from the character-class?
So the final thing should look like this:
private class MainWindow
{

   //Here the canvas is made visible and the rectangles are being drawn on the canvas

   //Then a method should start to create the character and move him through the maze

   //it should look like (character.move(1) so the character moves one step forward etc.)

}

private class Character
{
//here are the methods and attributes the character should have
}

Thanks in advance and sorry for my bad english :)

A:

If you look at the problem from the opposite direction, it's much easier to solve.
Create your character object, hook it up so that everything works as you expect in your data (model).  Then, you'll want to add properties that represent the location of the character, such as
public int XCoordinate { get; set; }
public int YCoordinate { get; set; }

Make sure the movement is done model-side.  If you try to drive movement based on the visual display, it will over complicate the program.
Next, define the view of the character in your canvas, something like this:
<Canvas ...>
    <Image Canvas.Left="{Binding XCoordinate}" Canvas.Top="{Binding YCoordinate}" .../>
</Canvas>

Last, make sure your binding syntax is correct (did you set the DataContext?) and be sure to set up NotifyPropertyChanged to taste (both of these are well-covered elsewhere).  Then you will be set up with a neatly divided model and view, and it should be much easier to focus on movement logic or whatever else you should desire.

