Home > Enterprise >  Popup Style: background color
Popup Style: background color

Time:09-21

I'm quite a beginer in wpf and i want to set the background of my popup to another color in the following Code. I do not understand, what I'm making wrong.

Thanks in advance :)

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
        <Style TargetType="Popup" x:Key="popup">
            <Setter Property="Background" Value="blue"/>
        </Style>
        
</ResourceDictionary>

CodePudding user response:

Popup doesn't have background property.

Maybe put a grid inside of the popup and change background of the grid instead.

<Popup IsOpen="True">
        <Grid Background="blue" >

        </Grid>
</Popup>

To avoid such problems while working with new elements, you can rely on the IntelliSense suggestions to see what properties you can change from an element. They are really helpful.

  •  Tags:  
  • wpf
  • Related