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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:41:57+00:00 2026-05-27T23:41:57+00:00

I have a slider, and I’m updating the value internally. But also, user input

  • 0

I have a slider, and I’m updating the value internally. But also, user input is accepted, to change an internal parameter.

The question is: how can I know who raised the event, the user or the class where I change slider.value?

In my case, this is the handler:

    private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
        var slider = sender as Slider;
        if (slider == null) return;

        var col = this.SelectedColor;
        switch ((string)slider.Tag)
        {
            case "Hue": this.SetHue(ValueHue.Value); break; 
            case "Sat": this.SetSatBri(ValueSat.Value, CurrentBri); break;  
            case "Bri": this.SetSatBri(CurrentSat, ValueBri.Value); break;  
            case "R": this.SetColor(Color.FromRgb(Convert.ToByte(ValueR.Value), col.G, col.B)); break;
            case "G": this.SetColor(Color.FromRgb(col.R, Convert.ToByte(ValueG.Value), col.B)); break;
            case "B": this.SetColor(Color.FromRgb(col.R, col.G, Convert.ToByte(ValueB.Value))); break;
        }
}

The function doesn’t work correctly if the event wasn’t raised by user input. So how can I find that out?

  • 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-27T23:41:58+00:00Added an answer on May 27, 2026 at 11:41 pm

    You cannot determine how an event has been raised, so you are going to have to take a different approach. Probably the most common solution to this problem is to set a boolean field that indicates that the application is reacting to a specific state change. For example, when you update the value internally:

    private bool _settingValue = false;
    
    private void SetValueInternal()
    {
      _settingValue = true;
      mySlider.Value = newValue;
      _settingValue = false;
    }
    

    You can then alter the logic in your question based on the state of the _settingValue variable.

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

Sidebar

Related Questions

I have a Slider whose value can be changed either by user, or through
I have a slider with a maximum value of 9. Every Value shall change
I have 1 slider and 1 button: <div data-role=fieldcontain> <input type=range name=slider id=slider value=0
I have an slider animation but on clX.click event #close div hides before it
In my View I have a slider and a combobox . When I change
I have a Coda slider on one webpage (hand-crafted, not using the plugin, but
My earlier question was highlight column as per slider's single value Search specific column
I have a slider with minimum value 0 and maximum value 1 . When
I have a slider. Minimum value of this is 0sec and maximum value is
i have a question regarding slider tags. Lets assume i have a slider and

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.