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 6885487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:38:28+00:00 2026-05-27T05:38:28+00:00

I have to create style for popups. I am using WPF and .NET Framework

  • 0

I have to create style for popups. I am using WPF and .NET Framework 4.

I have written style:

<Style x:Key="PopupBox" TargetType="{x:Type Popup}">   
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Popup}">       
                <Grid>  
                    <Border BorderBrush="Blue" Background="#FFFFFFFF">
                        <Grid>                                
                            <Border Background="AliceBlue"/>  
                            <ContentPresenter ContentSource="Header" /> 
                            <ContentPresenter/>
                            <Border BorderBrush="#FFFFFFFF" Background="#FFBFDBFF"/>
                        </Grid>
                    </Border>
                </Grid>                    
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style> 

I have cut off from this code some elements like grid row and column definitions because they are not significant.

So it seems that I can’t use <Setter Property="Template"> because Popup control doesn’t have this property. How can I work around this?

Any help here much appreciated!

  • 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-27T05:38:28+00:00Added an answer on May 27, 2026 at 5:38 am

    As Popup doesn`t have any template and just a Child property for content, you can use some other control (for example ContentControl) to style and template:

    <Style x:Key="PopupContentStyle" TargetType="ContentControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Border BorderBrush="Blue" Background="#FFFFFFFF">
                        <Grid>                                
                            <Border Background="AliceBlue"/>  
                            <ContentPresenter/>
                            <Border BorderBrush="#FFFFFFFF" Background="#FFBFDBFF"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
         </Setter>
    </Style>
    

    Then just place it in every Popup that needs it:

    <Popup>
        <ContentControl Style="{StaticResource PopupContentStyle}">
           <!-- Some content here -->
        </ContentControl>
    </Popup>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a engine style Rails plugin from which I can create a gem
I have a simplr svg-graph and I'm trying to create a simple tooltip-popup for
I am creating a popup dialog using microsoft's WPF. The thing is that this
Using jquery dialog I have created a popup box with a form. I am
I understand that to apply a style you have to create the textview and
I need to create a custom control containing a combobox whose popup will have
I'm trying to create a simple modal popup. I have the CSS done, and
I have created a default style for a Button including a custom ControlTemplate like
I have created a custom style and template for MenuItem and ContextMenu, and for
We have created a new List View Style that shows thumbnails from a picture

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.