views:

200

answers:

2

Popup popUpControl = new Popup();

popUpControl.PlacementTarget = this;

popUpControl.StaysOpen = true;

popUpControl.Child = new MyUserControl(); /// my user control

popUpControl.Opacity = 0.5; // this code has no effect in the appearance of the popup

popUpControl.IsOpen = true;

how to do ? Thanks in advance.

A: 

You should Enable Popup to have Transparency. Add following line of code.

popUpControl.AllowsTransparency=true;
Sasikumar D.R.
Hi Sasikumar,Thanx for ur reply.. i hv tried but still not working..please put this following code in a wpf test app and see,Popup poUp = new Popup(); poUp.PlacementTarget = this; poUp.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint; poUp.StaysOpen = true; poUp.PopupAnimation = PopupAnimation.Scroll; poUp.VerticalOffset = 52; poUp.HorizontalOffset = 5; poUp.Child = new Button() { Width = 300, Height = 50, Background = Brushes.Gray}; poUp.AllowsTransparency = true;
Subindev
Jay is right. You need to specify Opacity on Content. Try to add a grid as child to popup and add all your controls in this grid. Configure Opacity of Grid to reflect it in its children.
Sasikumar D.R.
Yes it worked..
Subindev
+1  A: 

you need to set the opacity on the popup content. So for your button have poUp.Child = new Button() { Width = 300, Height = 50, Background = Brushes.Gray, Opacity = 0.5 };

Jay
Thanks Jay.. It worked :)
Subindev