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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:19:42+00:00 2026-06-14T07:19:42+00:00

I have a C# WPF application with a bunch of labels. When I run

  • 0

I have a C# WPF application with a bunch of labels.
When I run my program it does some checks and wether it the check was positive or not it sets it’s corrisponding label to green og red.
These changes is done in my .cs file like:

lblCheck14.Foreground = new SolidColorBrush(Colors.Green);

I would like to add a “Reset” button, that reset the application to it’s initial start.
How can I easiest implement this?

One way – but I really hope there is a smarter way, is to set them all like:

    lblCheck14.Foreground = new SolidColorBrush(Colors.Black);
    lblCheck21.Foreground = new SolidColorBrush(Colors.Black);
    lblCheck42.Foreground = new SolidColorBrush(Colors.Black);

Etc..

But isn’t there a function which I can call that strips away any changes the .cs file have done to the controls in the XAML file? Like make the XAML back to stock?

Sorry for my back explanation. Hope you understand me 🙂

Best regards

  • 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-14T07:19:43+00:00Added an answer on June 14, 2026 at 7:19 am

    Implement styles. You can have a default style to roll back to when you hit reset.

    Take a look at this tutorial if you’re unfamiliar with them: http://wpftutorial.net/Styles.html

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

Sidebar

Related Questions

I have a C# WPF application where I need to create a bunch of
I am building a WPF application and I have some DependencyProperties in my window's
So I have a bunch of WPF Windows in my Windows Application. I want
I have wpf prism application with some modules. One module has folder sounds and
I have WPF application in which user enters some text in rich text box(rtb),
I have a WPF application in VS 2008 with some web service references. For
I have a WPF (.Net 3.5 sp1) application that loads a bunch of data
I have a WPF application written in VS2010 Express for .Net 4. Some testers
I have WPF Application where I have One main form and other user controls
I have WPF C# application that communicate with a PLC (i.e. write/read Omron PLC's

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.