如何解决使网格3d外观
| Silverlight是一种新功能,如何使网格具有3D外观(有点像Silverlight进度条在视觉上脱颖而出)。我觉得我已经尝试了所有东西,但是我没有想法。谁能给我一个可以做到这一点的代码片段?解决方法
您是否尝试过使用DropShadowEffect?
<data:DataGrid>
<data:DataGrid.Effect>
<DropShadowEffect />
</data:DataGrid.Effect>
...
...
</data:DataGrid>
当然,您也可以在其他控件上使用它。
产生凹陷的效果与照明的幻觉有关。如果在元素周围绘制边框,顶部和左侧分别为深色和底部和右侧为浅色,则您会感觉内容已沉入表面。切换阴影将使内容升高。
这是一个小例子来说明
<UserControl x:Class=\"SilverlightApplication1.MainPage\"
xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"
xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"
xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"
mc:Ignorable=\"d\"
d:DesignHeight=\"300\" d:DesignWidth=\"400\" >
<Grid x:Name=\"LayoutRoot\" Background=\"Lightgray\">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row=\"1\" Grid.Column=\"1\" Orientation=\"Vertical\">
<!-- Sunken -->
<Grid Width=\"100\" Height=\"25\" Background=\"Wheat\" Margin=\"0,5,0\">
<!-- Draw the 3d border -->
<Rectangle Height=\"1\" Fill=\"DarkGray\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Top\" />
<Rectangle Width=\"1\" Fill=\"DarkGray\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Stretch\" />
<Rectangle Height=\"1\" Fill=\"White\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Bottom\" />
<Rectangle Width=\"1\" Fill=\"White\" HorizontalAlignment=\"Right\" VerticalAlignment=\"Stretch\" />
<!-- Put your content in this Grid -->
<Grid>
<TextBlock VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" Text=\"Sunken\" />
</Grid>
</Grid>
<!-- Raised -->
<Grid Width=\"100\" Height=\"25\" Background=\"Wheat\" Margin=\"0,0\">
<!-- Draw the 3d border -->
<Rectangle Height=\"1\" Fill=\"White\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Top\" />
<Rectangle Width=\"1\" Fill=\"White\" HorizontalAlignment=\"Left\" VerticalAlignment=\"Stretch\" />
<Rectangle Height=\"1\" Fill=\"DarkGray\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Bottom\" />
<Rectangle Width=\"1\" Fill=\"DarkGray\" HorizontalAlignment=\"Right\" VerticalAlignment=\"Stretch\" />
<!-- Put your content in this Grid -->
<Grid>
<TextBlock VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" Text=\"Raised\" />
</Grid>
</Grid>
</StackPanel>
</Grid>
</UserControl>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。