模糊的WPF容器的背景 [英] Blur the background of the WPF container

查看:756
本文介绍了模糊的WPF容器的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后,我想实现的是复制一些扩展的WPF内容控制的Aero玻璃功能。

Ultimately, what I want to achieve is a replication to some extend, of an Aero glass functionality of a WPF content control.

如果我申请了 BlurEffect 的StackPanel 包含的TextBlock ,我将有的TextBlock 的文字模糊不清。

If I apply the BlurEffect to a StackPanel that contains a TextBlock, I will have the TextBlock's text blurred.

考虑这样一个例子:

没有模糊

< BlurEffect半径=5KernelType =高斯/>

但有一个WPF的方式来模糊面板后面的背景,而不是它的内容是什么?

But is there a WPF way to blur the background behind the panel, and not it's contents?

的背景的StackPanel 是一个桌面,并且承载它设置为 ALLOWTRANSPARENCY =真,允许自定义形状的外观。

The background of the StackPanel is a desktop, and the window that hosts it is set to AllowTransparency="True" to allow the custom-shaped look.

推荐答案

什么是对的StackPanel的背景是什么?一个的ImageBrush?如果是这样,为什么你不能申请BlurEffect这个问题?

What the background of the StackPanel? an ImageBrush? If so why cant you apply BlurEffect to that?

如果这是不可能的,那么试试这个。

If that is not possible then try this..

1]使用的图像,完全借鉴过来电网,我看你不想要一个 TileEffect 。添加 BlurEffect 这个图片。请确保您填写图像的统一。

1] Use an image and draw it completely over Grid as I see you dont want a TileEffect. Add BlurEffect to this Image. Make sure you fill image the uniformly.

2]然后加入的StackPanel 透明背景的下一个孩子电网即不倒车影像和StackPanel中的顺序。

2] Then add StackPanel with transparent background as next child in the Grid i.e. dont reverse the order of image and stackpanel.

3]然后添加的TextBlock 中的StackPanel。

3] Then add TextBlock in StackPanel.

如果你坚持使用来设置为面板的backgrounnd然​​后用的VisualBrush 绘制一个模糊的图像作为背景,而不是StackPanel中的,的ImageBrush

If you insist on using a Brush to be set as the backgrounnd of the panel then use VisualBrush that draws a blurred image as background of the stackpanel, instead of ImageBrush.

让我知道如果任何这些提示可以帮助您。

Let me know if any of these tips help.

这篇关于模糊的WPF容器的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆