Popup can't be made transparent by setting Opacity property
See original GitHub issueI want to create a Dialog like this pic:
Below is the xaml code of dialog content which is a UserControl and will be put in the Child of Popup:
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AvaloniaApplication10.UserControl1">
<Grid Background="Gray" Opacity="0.5" >
<Border Width="200"
Height="200"
BorderBrush="Red"
BorderThickness="2"
Background="White">
<TextBlock Text="Hello World Dialog!" />
</Border>
</Grid>
</UserControl>
I’ve subscribed the Bounds property of the MainWindow to make it to cover the full window. But the problem is Opacity=“0.5” has not effect. I also has set the Opacity property of the Popup, but still not working. I also have try to custom the PopupRoot Style, but still can’t make it work.
Is there any way to get this work? Thanks! (The project is Win32)
[EDIT] Just tested WPF and UWP, both can be made transparent by set their child’s transparency properly.
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
Popup po = new Popup();
po.Child = new Border() { Width = 300, Height = 300,
Background = Brushes.Beige,
Opacity = 0.5};
po.StaysOpen = true;
po.AllowsTransparency = true;
po.PlacementTarget = sender as FrameworkElement;
po.IsOpen = true;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
How To Use Opacity and Transparency to Create a Modal ...
Throughout this tutorial, you will use various ways to apply opacity and extra properties to effectively accomplish certain effects. You will ...
Read more >Set the combobox's popup background transparent
If you want to have a Transparent background instead of a Black one, you'll have to set the AllowsTransparency property of the Popup...
Read more >How to make a box semi-transparent - Learn web development
This guide will help you to understand the ways to make a box semi-transparent using CSS.
Read more >How to Set Opacity of Images, Text & More in CSS
The first div is set to be completely opaque. ... You can use the CSS opacity property to make the background of an...
Read more >Popup - How to set a transparency
Hello,. I need to set the background of certain dxPopup transparent programmaticaly, not using CSS and I can't figure it out
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Another way to achieve this is to use a panel covering everything else in your main window and avoid popups altogether.
Shouldn’t be an issue anymore. If it is - ping me here.