DropShadowEffect

3 posts, 1 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 13 Jun 2012 Link to this post

    I can create RadContextMenu with a DropShadowEffect if I just show it in a Grid; however if I try and attach it to a Window.ContextMenu (or any other control) the shadow doesn't appear.  I've tried all sorts of variations using Resource Styles and ResourceDictionaries, and nothing works.  I'm including the MainWindow.xaml source and a screen shot showing the results.

    <Window
        x:Class="WpfApplication2.MainWindow"
        x:Name="Window"
        Title="MainWindow"
        Width="640" Height="480"
        >
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu ClickToOpen="True"
                                    InheritDataContext="False">
                <telerik:RadContextMenu.Effect>
                    <DropShadowEffect ShadowDepth="3" Opacity="0.445" RenderingBias="Quality"/>
                </telerik:RadContextMenu.Effect>
                    <telerik:RadMenuItem Header="Copy" />
                    <telerik:RadMenuItem Header="Paste" />
                    <telerik:RadMenuItem Header="Cut" />
                    <telerik:RadMenuItem IsSeparator="True" />
                    <telerik:RadMenuItem Header="Select All" />
                </telerik:RadContextMenu>
        </telerik:RadContextMenu.ContextMenu>
     
        <Grid x:Name="LayoutRoot">
            <telerik:RadContextMenu
                Margin="105,53,247,147"
                ClickToOpen="True"
                InheritDataContext="False">
                <telerik:RadContextMenu.Effect>
                    <DropShadowEffect ShadowDepth="3" Opacity="0.445" RenderingBias="Quality"/>
                </telerik:RadContextMenu.Effect>
                <telerik:RadMenuItem Header="Item 1">
                    <telerik:RadMenuItem Header="Sub Item 1"/>
                    <telerik:RadMenuItem Header="Sub Item 2"/>
                </telerik:RadMenuItem>
                <telerik:RadMenuItem Header="Item 2">
                    <telerik:RadMenuItem Header="Sub Item 3"/>
                    <telerik:RadMenuItem Header="Sub Item 4"/>
                    <telerik:RadMenuItem Header="Sub Item 5"/>
                </telerik:RadMenuItem>
            </telerik:RadContextMenu>
        </Grid>
    </Window>



    What am I doing wrong?

    Thanks in advance,
    Steve



  2. Answer
    Dani
    Admin
    Dani avatar
    848 posts

    Posted 18 Jun 2012 Link to this post

    Hi Steve,

    You can give the RadContextMenu a little Margin of about 10px to allow it to pop up from the back and have the room to display its DropShadowEffect.

    Alternatively, if you need to apply the same for the second-level popup, you will need to edit the template of the RadMenuItem.

    I hope this will help.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 18 Jun 2012 Link to this post

    Worked like a charm!
    Thanks,
    Steve
Back to Top