s.jpg added to solution with BuildAction==Resource.
XAML
<UserControl x:Class=...>
<Canvas x:Name="LayoutRoot">
</Canvas>
</UserControl>
CS
Image Model = new Image();
Model.Source = new BitmapImage(new Uri("/s.jpg", UriKind.Relative));
LayoutRoot.SetLeft(Model, Coor.X);
LayoutRoot.SetTop(Model, Coor.Y);
Model.Width = 50;
Model.Height = 30;
LayoutRoot.Children.Add(Model);
Here's my question: were is my image? It has't appeared on the screen, though if i change XAML to
<UserControl x:Class=...>
<Canvas x:Name="LayoutRoot">
<Image Source="s.jpg"></Image>
</Canvas>
</UserControl>
you can see it, also if change CS to
Ellipse Model = new Ellipse();
Model.Fill = new SolidColorBrush(Colors.Gray);
Model.Stroke = new SolidColorBrush(Colors.Blue);
LayoutRoot.SetLeft(Model, Coor.X);
LayoutRoot.SetTop(Model, Coor.Y);
Model.Width = 50;
Model.Height = 30;
LayoutRoot.Children.Add(Model);
i'll see that ellipse. so what the problem?