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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:47:02+00:00 2026-06-14T13:47:02+00:00

My question is about wp7. I’m trying to change the Content of a Button

  • 0

My question is about wp7. I’m trying to change the Content of a Button in c# behind-code, after user clicks it. In particular I want to change the Fill property of my three Path elements, that are inside a grid(“GraphGrid”). This grid is the Content of the Button itself.
Here is XAML code about the Button:

<Button.Content>
  <Grid x:Name="GraphGrid" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" 
   VerticalAlignment="Stretch">
   <Path x:Name="Path"
      Data="M 0,0 0,80 20,80 20,0Z"
  Stroke="Black"
  Fill="Black"
  StrokeThickness="0"/>
<Path
  Data="M 25,20 25,80 45,80 45,20Z"
  Stroke="Black"
  Fill="Black"
  StrokeThickness="0"/>
<Path
  Data="M 50,40 50,80 70,80 70,40Z"
  Stroke="Black"
  Fill="Black"
  StrokeThickness="0"/>                         

I tried to use keys(such as x:Name…) to refer to my Xaml element in c# behind code, but it doesn’t work.

  • 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-06-14T13:47:03+00:00Added an answer on June 14, 2026 at 1:47 pm
       <Grid>
        <Button Click="Button_Click">
        <Button.Content>
            <Grid x:Name="GraphGrid" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" 
    VerticalAlignment="Stretch">
                <Path x:Name="Path"
          Data="M 0,0 0,80 20,80 20,0Z"
      Stroke="Black"
      Fill="Black"
      StrokeThickness="0"/>
                <Path x:Name="path1"
         Data="M 25,20 25,80 45,80 45,20Z"
         Stroke="Black"
         Fill="Black"
         StrokeThickness="0"/>
                <Path x:Name="Path2"
         Data="M 50,40 50,80 70,80 70,40Z"
         Stroke="Black"
         Fill="Black"
         StrokeThickness="0"/>
            </Grid>
        </Button.Content>
        </Button>
    </Grid>
    

     

     private void Button_Click(object sender, RoutedEventArgs e)
        {
            path1.Fill = new SolidColorBrush(Colors.AliceBlue);
            Path2.Fill = new SolidColorBrush(Colors.Pink);
            Path.Fill = new SolidColorBrush(Colors.Red);
        }
    

    I hope this will help.

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

Sidebar

Related Questions

I have a question about data binding in WP7 using c# code. If I
Question about code performance: I'm trying to run ~25 regex rules against a ~20g
Quick question about JavaScript event objects - how does JavaScript know when I'm trying
hi i have a question about the silverlight/xna template for wp7 programming. i start
Quick question about cursors (in particular Oracle cursors). Let's say I have a table
I have a question about the IsolatedStorageSettings in WP7. normally i parsed all my
Question about anchors in html , with maximum seo-friendlyness as well as user-friendlyness. Currently,
A question about this R code: library(RODBC) ch <- tryCatch(odbcConnect(RTEST), warning=function(w){print(FAIL! (warning));return(NA)}, error=function(e){print(paste(ERROR:,geterrmessage()));return(NA)}) df
Another question about SVG style transitions... :) This time I'm trying to transition the
Question about subclassing in matlab, under the new class system. I've got class A

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.