Skip to main content
Home Forums Silverlight Programming Programming with .NET - General c# clip property
2 replies. Latest Post by fatihpiristine on May 8, 2008.
(0)
bituman
Member
2 points
4 Posts
05-09-2007 7:25 AM |
Hi. I tried to clip an image when not in fullscreen, and display full image when in fullscreen.
I tried setting the clip property, which waits a geometry. I tried creating a custom shape (rectangle) set the width and height, convert it to pathway, and set myImage.Clip = pathwayRectangle.Data; in the c# code.
Now this generates an exception.
How to clip the image from c# properly?
Thank you in advance
Bill Reiss
Contributor
4840 points
919 Posts
05-09-2007 8:21 AM |
Something like this works for me...
c.Clip = rg;
In my case, the canvas wraps the image, so I'm not sure if you would need to do something similar or clip the image itself.
fatihpir...
8 points
05-08-2008 9:15 AM |
RectangleGeometry xRect = new RectangleGeometry(); xRect.Rect = new Rect(100, 100, 100, 100); xRect.RadiusX = 20; xRect.RadiusY = 20; Image xImage = new Image(); xImage.Source = new BitmapImage(new Uri("1.jpg", UriKind.Relative)); xImage.Stretch = Stretch.Fill; xImage.Width = 300; xImage.Height = 200; xImage.Clip = xRect; LayoutRoot.Children.Add(xImage);This one works for images