WPF随笔---virtualBrush 实现模糊效果
最近做一个毛玻璃覆盖层效果

底层代码
<Grid x:Name="bg" Background="#00000000"> <StackPanel> <Button Height="40" HorizontalAlignment =" Left"> <Label Content="BtnBtn" FontWeight="Bold"/> </Button> <Button Height="40" HorizontalAlignment =" Left"> <Label Content="BtnBtn" FontWeight="Bold"/> </Button> <Button Height="40" HorizontalAlignment =" Left"> <Label Content="BtnBtn" FontWeight="Bold"/> </Button> </StackPanel> </Grid>
覆盖层代码
<Grid x:Name="cover" Visibility="Visible"> <Border> <Border.Background> <VisualBrush Visual="{Binding ElementName=bg}" Stretch="None"> </VisualBrush> </Border.Background> <Border.Effect> <BlurEffect Radius="4" RenderingBias="Performance"/> </Border.Effect> </Border> </Grid>
原始效果图

浙公网安备 33010602011771号