我在WPF-Windows上使用WindowStyle=None和ResizeMode=NoResize时遇到了投影问题。是否有任何好的替代方法可以在窗口内容上使用DropShadow-effect?我尝试过Shell Integration Library中的WindowChrome,但当ResizeMode=NoResize时没有显示任何“Chrome”。
如果能够在窗口边框外部绘制wpf-drop-shadow,那么可能是一个解决方案。如果我将阴影绘制在窗口内部,则会出现不同于标准行为的情况,例如在移动鼠标光标时。在执行此操作时,我的窗口不应进行命中测试,并且单击此区域应激活后面的窗口等。
Zune似乎绘制了自己的投影,因为它看起来并不像标准Chrome-shadow那样。但它的行为方式就像普通的投影,不会捕获鼠标事件。我想知道他们是如何做到这一点的。
Spotify还有另一种不会捕获鼠标事件的阴影。
我猜这些应用程序完全绘制了自己的WindowChrome,但是如何实现呢?在WPF中是否支持这个功能?
<Window x:Class="ShellIntegrationTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell"
Title="MainWindow" Height="512" Width="384" WindowStyle="None" ResizeMode="NoResize">
<shell:WindowChrome.WindowChrome>
<shell:WindowChrome ResizeBorderThickness="5" GlassFrameThickness="-1" CornerRadius="0" CaptionHeight="25" />
</shell:WindowChrome.WindowChrome>
</Window>