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

  • Home
  • SEARCH
  • 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 869795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:22:07+00:00 2026-05-15T10:22:07+00:00

I downloaded the Microsoft Visual Studio 2010 Express for Windows Phone and I wrote

  • 0

I downloaded the Microsoft Visual Studio 2010 Express for Windows Phone and I wrote a simple application to make a first test of the emulator. In this application I have only a button with the property Content binded to a string called ButtonText and with the property Background binded to a SolidColorBrush named FillColor. I handled the Click event with this code:

    void MyButton_Click(object sender, RoutedEventArgs e)
    {
        if (toggle == true)
        {
            ButtonText = "Blue";
            FillColor = new SolidColorBrush(Colors.Blue);
        }
        else
        {
            ButtonText = "Red";
            FillColor = new SolidColorBrush(Colors.Red);
        }
        toggle = !toggle;
    }

Unfortunately this doesn’t work. While the Content of the Button changes each time the button is pressed, I cannot say the same for the Background which remains at the same color.
Could you tell me what is wrong? Thank you.

I also post the XAML:

    <Grid x:Name="ContentGrid" Grid.Row="1">
        <Button Name="MyButton" Width="300" Height="300"
                Content="{Binding Path=ButtonText}" 
                Background="{Binding Path=FillColor}" />
    </Grid>
  • 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-15T10:22:07+00:00Added an answer on May 15, 2026 at 10:22 am

    The issue is with the use of “new” in the line:

    FillColor = new SolidColorBrush(Colors.Blue);

    Using the “new” operation breaks the data binding that was previously set up. Try using the following instead:

    FillColor.Color = Colors.Blue;

    Replace both the changes to Blue and to Red and that should do the trick.

    HTH!
    Chris

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

Sidebar

Related Questions

I am newbie to Windows Azure application. I have downloaded the Microsoft Visual Studio
I've downloaded and installed Visual C# 2010 Express and XNA Game Studio 4.0 on
What have I done? I'm using Microsoft Visual Studio 2010 1) I downloaded libevent-2.0.16-stable
I'm trying to distribute a small windows application I made in Visual Studio 2010
Installed Visual Studio Web Developer 2010 Express from the ISO available from this page:
I am using Microsoft Visual C# 2010 Express. I did not have access to
I have a Visual Studio 2010 solution that is checked in to Microsoft Visual
I want to create the webpart in Visual studio 2010/2008 environment with microsoft given
I have just downloaded and installed the VC++ 2010 Express tool from Microsoft. I
I am using Visual Studio 2010 Professional Edition, and Windows Vista. Firstly, I have

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.