I am a new student of WPF. here i have a question. I have an image, width: 360, height: 360. Here I want to crop this image, as shown below:
(0,0) - (120,120) save to the first ImageSource object,
(120,0) - (240,120) save to the second ImageSource object,
(240,0) - (360,120) save to the third ImageSource object;
......
Pls see more details in the picture below: 
My sample code is below:
private void CutImage(string img) { int iLeft = 0; int iTop = 0; int count = 0; Image thisImg = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri(img, UriKind.Relative); src.CacheOption = BitmapCacheOption.OnLoad; src.EndInit(); thisImg.Source = src; for (int i = 0; i < 3; i++) { iTop = i * 120; for (int j = 0; j < 3; j++) { iLeft = j * 120; Canvas canvas = new Canvas(); Rectangle destRect = new Rectangle(); destRect.SetValue(Canvas.LeftProperty, (double)0); destRect.SetValue(Canvas.TopProperty,(double)0); destRect.Width = destRect.Height = 120; Rect srcRect = new Rect(); srcRect.X = iLeft; srcRect.Y = iTop; srcRect.Width = srcRect.Height = 120; thisImg.Clip = new RectangleGeometry(srcRect); thisImg.Clip.SetValue(Canvas.TopProperty, (double)iTop); thisImg.Clip.SetValue(Canvas.LeftProperty, (double)iLeft); thisImg.Clip.SetValue(Canvas.WidthProperty, (double)120); thisImg.Clip.SetValue(Canvas.HeightProperty,(double)120); objImg[count++] = (ImageSource)thisImg.GetValue(Image.SourceProperty); } } }
but it doesnβt work as I expected, it seems that all ImageSource objects keep the same image, and not part of the body. Can anybody help me? THX
source share