Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:12:41+00:00 2026-05-27T08:12:41+00:00

I have a lot of popups in application (.NET Framework 4, WPF) and I

  • 0

I have a lot of popups in application (.NET Framework 4, WPF) and I have to set one style to all of them.
Example popup looks like that:

<Popup PopupAnimation="Fade" MinWidth="600" MinHeight="200" Placement="Center" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="True" IsOpen="False">
    <Grid Width="Auto" Height="Auto" Background="Gray">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>                   
            <RowDefinition Height="Auto"/>           
        </Grid.RowDefinitions>
        <Border BorderThickness="2" CornerRadius="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="2">
            <Border.BorderBrush>
                <SolidColorBrush Color="Gray"/>
            </Border.BorderBrush>
            <Border.Background>
                <SolidColorBrush Color="White"/>
            </Border.Background>
        </Border>

        <StackPanel Grid.Row="0">
            <Label Foreground="Blue" Content="Popup_Title"/>
        </StackPanel>

        <GroupBox Grid.Row="1" Header="Popup example content">
            <StackPanel>                      
                   ...                           
            </StackPanel>
        </GroupBox>      
    </Grid>
</Popup>

How can I take styles like borders and background to a style template?
I can’t write Style with TargetType Popup and modify it’s Property="Template" because Popup Control doesn’t have Property="Template". So how can I write style to those Popups?

EDIT:
Exact working style:

    <Style x:Key="PopupContentStyle" TargetType="ContentControl">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ContentControl">
                <Grid Width="Auto" Height="Auto" Background="Gray">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Border BorderThickness="2" CornerRadius="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="2">
                        <Border.BorderBrush>
                            <SolidColorBrush Color="Gray"/>
                        </Border.BorderBrush>
                        <Border.Background>
                            <SolidColorBrush Color="White"/>
                        </Border.Background>
                    </Border>

                    <StackPanel Grid.Row="0">
                        <Label Foreground="Blue" Content="Popup_Title"/>
                    </StackPanel>

                    <GroupBox Grid.Row="1" Header="Popup example content">
                        <StackPanel>
                            <ContentPresenter />
                        </StackPanel>
                    </GroupBox>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:12:42+00:00Added an answer on May 27, 2026 at 8:12 am

    I’d recommend wrapping your Popup’s Content in something like a ContentControl or a HeaderedContentControl and setting the style of that

    <Popup>
        <ContentControl Style="{StaticResource PopupContentStyle}">
            ...
        </ContentControl>
    </Popup>
    

    Example style…

    <Style x:Key="PopupContentStyle" TargetType="{x:Type ContentControl}">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
    
                    <Grid Width="Auto" Height="Auto" Background="Gray">
                       <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>                   
                            <RowDefinition Height="Auto"/>           
                        </Grid.RowDefinitions>
                        <Border BorderThickness="2" CornerRadius="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="2">
                            <Border.BorderBrush>
                                <SolidColorBrush Color="Gray"/>
                            </Border.BorderBrush>
                            <Border.Background>
                                <SolidColorBrush Color="White"/>
                            </Border.Background>
                        </Border>
    
                        <StackPanel Grid.Row="0">
                            <Label Foreground="Blue" Content="Popup_Title"/>
                        </StackPanel>
    
                        <GroupBox Grid.Row="1" Header="Popup example content">
                            <StackPanel>                      
                                   <ContentPresenter />                         
                            </StackPanel>
                       </GroupBox>      
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flash application that utilizes a lot of popup title windows that
I have lot of code in my Tornado app which looks like this: @tornado.web.asynchronous
At the moment, I have lot's of Java which does all kind of nifty
I have a lot of popups, which i need to place everywhere on the
We have a swing application which displays a lot of rectangles. We use Rectangle2D.double
I wanted to have a popup window when the user opens the application for
i have small problem i.e. their is one celltable with lot of data it
I have a web-application developed with jQuery with a web2.0 look & feel. All
i have taken over an asp.net mvc and i there are a lot of
I have an application with a lot of swing components, nested in several containers.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.