简体   繁体   中英

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.

<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? 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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