<navigation:Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" x:Class="SilverlightApplication1.PutCard" Title="PutCard Page" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot" Height="149" VerticalAlignment="Top" Width="640" > <Rectangle Margin="18,8,0,7" Height="134" HorizontalAlignment="Left" Width="96"> <Rectangle.Fill> <ImageBrush ImageSource="img/sha.jpg"/> </Rectangle.Fill> </Rectangle> </Grid> </navigation:Page> using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Windows.Navigation; using System.Windows.Media.Imaging; namespace SilverlightApplication1 { public partial class PutCard : Page { public PutCard() { InitializeComponent(); LoadPage(); } // Executes when the user navigates to this page. void LoadPage() { int count=5; //Image[] im=new Image[count]; int cc=0; for(int i=1;i<=count;i++) { Rectangle r=new Rectangle(); r.Name="r"+i.ToString(); r.Fill = new ImageBrush() { ImageSource = new BitmapImage(new Uri("img/sha.jpg", UriKind.Relative))}; r.Width=96; r.Height=134; r.Margin=new Thickness(cc,0,0,0); LayoutRoot.Children.Add(r); cc+=100; } //Rectangle r2=LayoutRoot.Children.Select("r2"); //r2.Fill=new ImageBrush() { ImageSource = new BitmapImage(new Uri("img/shan.jpg", UriKind.Relative))}; } protected override void OnNavigatedTo(NavigationEventArgs e) { } } }