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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:52:02+00:00 2026-05-26T00:52:02+00:00

I have a button with multiple contetnt. I want to change it’s text when

  • 0

I have a button with multiple contetnt. I want to change it’s text when the button is clicked.

XAML:

<Button HorizontalAlignment="Left" Height="114" Margin="33,58,0,0" VerticalAlignment="Top" Width="224" Style="{StaticResource GlassButtonStyle}" FontSize="26.667" Click="Button_Click_1" Name="button1">
            <StackPanel Orientation="Horizontal">
                <Rectangle Height="69" Stroke="Black" Width="69">
                    <Rectangle.Fill>
                        <LinearGradientBrush EndPoint="0.004,1.044" StartPoint="0.739,0.25">
                            <GradientStop Color="Black" Offset="0"/>
                            <GradientStop Color="White" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>

                <ContentPresenter Content="Clicke me" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </StackPanel>
</Button>

C# code:

button1.Content = "Hello world";

This makes the rectangle disappear, though I want only to change the text. How can I do this?

  • 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-26T00:52:02+00:00Added an answer on May 26, 2026 at 12:52 am

    You need to modify the Control Template of Button to show your rectangle all the time.

    <Button HorizontalAlignment="Left" Height="114" Margin="33,58,0,0" VerticalAlignment="Top" Width="224" Style="{StaticResource GlassButtonStyle}" FontSize="26.667" Click="Button_Click_1" Name="button1" Content="Click Me">
    <Button.Template>
    <ControlTemplate>
                <StackPanel Orientation="Horizontal">
                    <Rectangle Height="69" Stroke="Black" Width="69">
                        <Rectangle.Fill>
                            <LinearGradientBrush EndPoint="0.004,1.044" StartPoint="0.739,0.25">
                                <GradientStop Color="Black" Offset="0"/>
                                <GradientStop Color="White" Offset="1"/>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
    
                    <ContentPresenter Content="{TemplateBinding Content}" />
                </StackPanel>
    
    </ControlTemplate>
    </Button.Template>
    </Button>
    

    See Using Control Templates to Customize a Control’s Look and Feel

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

Sidebar

Related Questions

I have an enlarge-button near the slider. Now I want to change the href
I have an aspx page with multiple FileUpload controls and one Upload button. In
I have an image sprite of sorts with multiple frames for 1 button. I'm
I have a gridview with multiple rows, each has a Update button and I
I have a button on an ASP.NET wep application form and when clicked goes
Say I have multiple EditTexts in an application. When I click a Button, I
I want to show multiple columns in the list box. I have referred the
I'm working with XAML in Windows 8 Metro. I have a grid with multiple
I have a page where onclick on a button displays the text content from
Multiple sites have buttons where you can tweet, digg, etc. On this page you'll

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.