background border in context menu

2 posts, 0 answers
  1. Victor
    Victor avatar
    3 posts
    Member since:
    Jan 2013

    Posted 14 Jul 2014 Link to this post

    How do I make the background in the context menu semi-transparent background with opacity of 0.50?


    _ContextMenu.Margin = new Thickness(0,200,0,0);
    _ContextMenu.BorderBrush = new SolidColorBrush(Colors.Green);
    _ContextMenu.BorderThickness = new Thickness(10, 10, 10, 10);
    _ContextMenu.IsFadeEnabled = true;
    _ContextMenu.Background = new SolidColorBrush(Colors.Transparent);

    using this code I get a completely transparent background but I want an opaque background of 50% black.
    setting the _ContextMenu.Opacity = 0.50; does not seem to change anything.

    Do I need to add a border somehow?

    Thanks,
    Victor
  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    551 posts

    Posted 16 Jul 2014 Link to this post

    Hi Victor,

    Thank you for the question.

    Instead of setting the Opacity of the ContextMenu, you have to set its Background to a color with alpha component:
    _ContextMenu.Background = new SolidColorBrush(new Color { A = 25, R = 0, G = 0, B = 0 });

    I hope this helps. Please, let us know if you have further questions.

    Regards,
    Rosy Topchiyska
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top