2021年3月12日星期五

WPF VisualBrush won't paint grid background

I created a System.Windows.Media.VisualBrush with the source below. I thought it would work as the background of a grid. But nothing of my brush appears in the grid. What am I doing wrong? The background should resemble waves on an ocean.

<VisualBrush      x:Name="brBrush"      x:Key="WaveBr"      Stretch="None"      TileMode="Tile"      Viewbox="40,0,120,20">      <VisualBrush.Visual>          <Grid>              <Grid.Effect>                  <BlurEffect                      Radius="2" />              </Grid.Effect>              <Grid.RowDefinitions>                  <RowDefinition />              </Grid.RowDefinitions>              <Grid.ColumnDefinitions>                  <ColumnDefinition                      Width="*" />              </Grid.ColumnDefinitions>              <Rectangle                  Fill="LightCyan" />              <Path                  Data="M0,10 C40,20 80,10 120,0 C160,20 200,10 240,0"                  StrokeThickness="1"                  Stroke="Teal"                  Panel.ZIndex="1" />          </Grid>      </VisualBrush.Visual>  </VisualBrush>  
https://stackoverflow.com/questions/66610035/wpf-visualbrush-wont-paint-grid-background March 13, 2021 at 12:06PM

没有评论:

发表评论