SurfaceScrollView:淡出不可见的内容

时间:2011-01-19 14:29:53

标签: c# .net wpf pixelsense

是否有可能淡出SurfaceScrollViewer中不可见的内容?

正如我在答案中提到的那样,但我无法识别任何褪色:

//fading out
                Rectangle fade = new Rectangle();
                fade.Width = 478;
                fade.Height = 140;
                fade.IsHitTestVisible = false;
                LinearGradientBrush myBrush = new LinearGradientBrush();
                myBrush.GradientStops.Add(new GradientStop(Color.FromArgb(50, 50,50,50), 0.0));
                myBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 0.5));
                myBrush.GradientStops.Add(new GradientStop(Color.FromArgb(50, 50, 50, 50), 1.0));
                fade.Fill = myBrush;

1 个答案:

答案 0 :(得分:2)

我终于解决了这个问题:

GradientStopCollection collection = new GradientStopCollection();
collection.Add(new GradientStop(Colors.Transparent, 0));
collection.Add(new GradientStop(Colors.Black, 0.1));
collection.Add(new GradientStop(Colors.Black, 0.9));
collection.Add(new GradientStop(Colors.Transparent, 1));
LinearGradientBrush brush = new LinearGradientBrush(collection);

scroller.OpacityMask = brush;