所以当我在寻找无边界的wpf形式来投射阴影的方法时,我找到了this。它会产生像visual studio或microsoft office那样的阴影。从提到的网站下载后,我在我的项目中引用了WindowGlows.dll文件,并从视线中的示例中复制了此代码。
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WindowGlows="http://GlowWindow.codeplex.com/"
x:Class="WindowGlowsTestApp.MainWindow"
Title="MainWindow"
Height="350"
Width="525"
WindowGlows:GlowManager.EnableGlow="True"
WindowGlows:GlowManager.ActiveGlowBrush="CornflowerBlue"
WindowGlows:GlowManager.InactiveGlowBrush="LightGray">
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="0"
CornerRadius="0"
CaptionHeight="36"
ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Border BorderThickness="1"
BorderBrush="{Binding Path=(WindowGlows:GlowManager.ActiveGlowBrush),RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="36" />
<RowDefinition />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<Rectangle Fill="{Binding Path=(WindowGlows:GlowManager.ActiveGlowBrush),RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"
Margin="-1,11,-1,0"
StrokeThickness="0"
ClipToBounds="True" />
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Title, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
Foreground="{Binding Path=(WindowGlows:GlowManager.InactiveGlowBrush),RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"
Margin="0,11,0,0" />
<Rectangle Grid.Row="2"
Fill="{Binding Path=(WindowGlows:GlowManager.ActiveGlowBrush),RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"
Margin="-1,0,-1,-1"
StrokeThickness="0"
ClipToBounds="True" />
</Grid>
</Border>
当我点击开始时,表格会掉出一个奇妙的阴影,我可以把它用到很好的用途,但我无法摆脱错误,这告诉我
Error 1 The name "GlowManager" does not exist in the namespace
我还有6个关于辉光管理器的错误,但没有别的,我该如何更正命名空间?
答案 0 :(得分:0)
该命名空间对我来说不合适。
假设您在项目中使用了玩偶的参考,最简单的方法是使用混合,从资产标签中删除该DSL中的对象,它将完成剩下的工作。视觉工作室的帮助不大。
如果没有确切了解您所拥有的内容,我能提供的最佳功能就是将命名空间标记更改为此格式的内容...
Xmlns:windowchrome="clr-namespace:<namespace of targeted objects>,assembly=<assembly name as seen in references folder>"
msdn包含更多细节,http://msdn.microsoft.com/en-gb/library/bb514546%28v=vs.90%29.aspx
答案 1 :(得分:0)
在阅读this link后,我将整个项目直接复制到我的C盘根目录并从那里打开,现在它的工作非常好。看起来它是一个视觉工作室的bug,如果有的话。