如何在 WP8.1 (WinRT) 中创建一个向外反射渐变的矩形?

How to create a rectangle with a gradient that reflect outwards in WP8.1 (WinRT)?

我正在尝试创建一个具有向外反射的渐变的矩形。我想要类似于 this 的东西(但对于 rectangle/grid)。我无法使用 LinearGradientBrush 实现它。以下是我尝试过的。但这根本不是我想要的。

<Border Grid.Row="1" Grid.ColumnSpan="2">
  <Border.Background>
     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="Black" Offset="0" />
        <GradientStop Color="White" Offset="1" />
     </LinearGradientBrush>
  </Border.Background>

谢谢。

这是可行的,但很棘手。您需要在 Blend 中执行此操作,因为有一个渐变工具可让您轻松旋转渐变并调整渐变停止点。您需要一个 parent 网格和两个大小相等的 child 网格。一个 child 需要渐变是水平的,另一个是垂直的。您必须调整两个网格的不透明度,使渐变看起来是一个。我在几分钟内将这个 XAML 拼凑在一起,所以它并不完美,但它可能会对你有所帮助....

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid Height="200">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.51,1.024"
                                 StartPoint="0.507,0.052">
                <GradientStop Color="White"
                              Offset="1" />
                <GradientStop Color="#FFF7F7F7"
                              Offset="0.098" />
                <GradientStop Color="Black"
                              Offset="0.5" />
                <GradientStop Color="#FFC3C3C3"
                              Offset="0.211" />
                <GradientStop Color="White"
                              Offset="0.829" />
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
    <Grid Height="200"
          Margin="0,220">
        <Grid.Background>
            <LinearGradientBrush EndPoint="1.001,0.588"
                                 StartPoint="-0.001,0.596">
                <GradientStop Color="White"
                              Offset="1" />
                <GradientStop Color="#FFF7F7F7" />
                <GradientStop Color="#7F000000"
                              Offset="0.498" />
            </LinearGradientBrush>
        </Grid.Background>
    </Grid>
</Grid>