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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:41:25+00:00 2026-05-28T00:41:25+00:00

I need to display pop ups in my app. So I have user controls

  • 0

I need to display pop ups in my app. So I have user controls to make customised pop ups. Every pop up shows a different message and different set of buttons. Can I reuse the same xaml to alter the text and make new buttons? Or do I have to create seperate usercontrols?

 <Grid Height="250" Width="480">
    <Canvas Margin="0,0,0,0">
        <Canvas.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0"/>
                <GradientStop Color="#FF121111" Offset="1"/>
            </LinearGradientBrush>
        </Canvas.Background>
        <Button Content="Buy" x:Name="buttonBuy" Click="btnBuyNow_Click" BorderThickness="0" Style="{StaticResource UserControlBuy}" MinWidth="96" MinHeight="98" FontFamily="{StaticResource CicleFina}" FontSize="18.667" Canvas.Left="189" Canvas.Top="141" Height="98" Width="96" Foreground="#FF0E0C0C">
            <Button.Background>
                <ImageBrush ImageSource="Images/02/but_bg_trial_buy.png"/>
            </Button.Background>                
        </Button>
        <TextBlock TextWrapping="Wrap" FontSize="21.333" Padding="10" Text="Your trial period is over. Please purchase the full version" Height="141" Width="479"  Foreground="#D48394" FontFamily="{StaticResource PeaSnow}" TextAlignment="Center" d:LayoutOverrides="Width, Height"/>
    </Canvas>
</Grid>

This is how i’ve called the pop up in the app. .

        Popup popup = new Popup();
        BuyNowUserControl content = new BuyNowUserControl(popup);
        // set the width of the popup to the width of the screen
        content.Width = System.Windows.Application.Current.Host.Content.ActualWidth;
        popup.Child = content;
        popup.VerticalOffset = 300;
        popup.IsOpen = true;

Thanks

Alfah

  • 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-28T00:41:25+00:00Added an answer on May 28, 2026 at 12:41 am

    Yes, you can re-use them. I would do the following:

    1. Create dependency properties on your user control for the customizable text you require.
    2. Set the UserControl’s DataContext to itself
    3. Replace your hard-coded text in the above XAML with a binding to the dependency property added in (1)
    4. You can now set the text on the user control instance after you have created it. The binding will ensure that the UI reflects this.

    It is actually quite a bit of work to achieve this, so worth evaluating the benefit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to display a login-pop-up window when the user clicks on the links
I am new to Android Programming. I need to display a Pop-Up message in
I need to display an error message on rejecting a drop in my application.
I need to display a variable-length message and allow the text to be selectable.
Assume I have these tables, from which i need to display search results in
I have a large result set assembled in a parent/child relationship. I need to
Ok, I need to use ajax for some fancy pop-ups and validation things but
I need to display the current selection for select table as a pop up
i am developing one application with map view i need display the weather depends
I need to display many pages of news in a site. Should I do

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.