我在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);
}
}
结果:滚动一段距离后,它将被剪裁。