我添加Canvas
并ScrollViewer
设置画布剪辑如下。但是内容被剪辑了。我很困惑。请帮我。
public MainPage()
{
InitializeComponent();
for (int i = 0; i < 10; ++i)
{
Canvas canvas = new Canvas();
canvas.Width = 456;
canvas.Height = 456;
RectangleGeometry clipRect = new RectangleGeometry();
clipRect.Rect = new Rect(0, 0, 456, 456);
clipRect.RadiusX = 8;
clipRect.RadiusY = 8;
canvas.Clip = clipRect;
Image image = new Image();
image.Width = 456;
image.Height = 456;
image.Stretch=Stretch.Fill;
image.Source = new BitmapImage(new Uri("/ApplicationIcon.png", UriKind.Relative));
canvas.Children.Add(image);
scrollContent.Children.Add(canvas);
}
}
结果:滚动一段距离后,它会被剪掉。