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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:54:31+00:00 2026-05-27T08:54:31+00:00

I am new to c# and has a question about events on a WPF

  • 0

I am new to c# and has a question about events on a WPF application. I have two events (Button_Click and myslider_ValueChanged) and would like the myslider_ValueChanged to run after Button_Click. I have tried using EventHandler but it both events still run at the same time. Is there an easier way to do this such as a nested event? Any help is appreciated, thanks. I have attached my EventHandler attempt below.

    namespace program
    {
        public partial class MainWindow : Window
        {

            public event EventHandler _Click;
            public event EventHandler _ValueChanged;

            protected void On_Click(EventArgs e)
            {
                if (_Click != null)
                {
                    _Click(this, e);
                }
            }

            protected void On_ValueChanged(EventArgs e)
            {
                On_Click(EventArgs.Empty);

            }

            private void Initialize()
            {
                _Click += new EventHandler(_Click);
                _ValueChanged += new EventHandler(_ValueChanged);
                _Click += _ValueChanged;
            }


            private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
            {
              //Code here
            }

            private void myslider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
            {
            //Code here
            }
  • 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-27T08:54:31+00:00Added an answer on May 27, 2026 at 8:54 am

    You should have myslider_ValueChanged call a different method to perform the work, then call that new method from button_click.

    For example:

           private void myslider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
            {
               HandleValueSliderChanged();
            }
            private void HandleValueSliderChanged() {
              //Code here
            }
    
            private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
            {
              //Code here
               HandleValueSliderChanged();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question has two parts: Does anyone have any tips or references to some
Forgive me if this question has been asked before but I am new to
Being new to test based development, this question has been bugging me. How much
The new iPhone 3GS has support for voice commands, stuff like call Bill or
I am slowly moving into Silverlight from asp.net and have a question about how
I'm using Oracle to synchronize events between two nodes of my application server (never
I am creating application in MVC3. I have a ConferenceController which has a Create()
I have a simple Screen class in C# that has a bunch of events
I have two entities: Event and Comment. @Entity @Table(name = events) public class Event
I have a question about how things are going on under the hood with

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.