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 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 have downloaded the silver light from this http://www.microsoft.com/silverlight// I need to use this
I downloaded and installed the Aptana Studio free version. But apparently, to install the
I downloaded Hex Workshop, and I was told to read a .dbc file. It
I downloaded Reflector.Net and it's an .Exe outside VS. I remember (last year) when
Having downloaded Pango and GLib from the GTK+ Project's Win32 downloads page and having
have downloaded Orca to edit an MSI file. I want to remove some banner
I downloaded the Guidance Automation Toolkit for VS 2008 and in the middle of
I downloaded the Eclipse PDT 2.0 GA release (Eclipse 3.4), however, it doesn't look
I recently downloaded ndepend and ran an analysis on an open source project I
I have downloaded a font that looks less than desirable if it is not

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.