简体   繁体   English

在WPF的3D边框装饰

[英]3D border decorator in WPF

I need to give a 3D effect of a WPF control that I will use in an other WPF Control. 我需要给出一个WPF控件的3D效果,我将在其他WPF控件中使用它。

<UserControl>
    <ScrollViewer>
        <Border BorderThickness="0">
            <Border.Effect>
                <DropShadowEffect Color="Black"
                                  ShadowDepth="3"
                                  Direction="270" />
            </Border.Effect>
            <my:MyChildWpfControl x:Name="myControl"/>
        </Border>
    </ScrollViewer>
</UserControl>

Is there a way to directly put myControl into the ScrollViewer , without using Border child node? 有没有办法直接myControl放入ScrollViewer而不使用Border子节点? Something about decorators and adorners ... What is the simplest way to do it? 关于装饰者装饰者的 事情 ......最简单的方法是什么?

Do you mean? 你的意思是?

<UserControl>
    <ScrollViewer>
        <my:MyChildWpfControl>
            <my:MyChildWpfControl.BitmapEffect>
                <DropShadowEffect Color="Black"
                                  ShadowDepth="3"
                                  Direction="270" />
            </my:MyChildWpfControl.BitmapEffect>
        </my:MyChildWpfControl>
    </ScrollViewer>
</UserControl>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM