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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:07:10+00:00 2026-05-23T18:07:10+00:00

I need to implement a Ruler and I have a CustomControl RangeSlider which is

  • 0

I need to implement a Ruler and I have a CustomControl RangeSlider which is derived from Control and has several DependencyProperties (e.g. Minimum, Maximum, LowerValue, UpperValue).

public static readonly DependencyProperty LowerValueProperty =
  DependencyProperty.Register("LowerValue",
  typeof(double),
  typeof(RangeSlider),
  new FrameworkPropertyMetadata(0d, OnLowerValueChanged, CoerceLowerValue));

public double LowerValue
{
  get { return (double)base.GetValue(LowerValueProperty); }
  set { base.SetValue(LowerValueProperty, value); }
}

In Xaml, the Ruler has a sub control Scale (derived from Canvas), which needs the same Properties to draw the Scaling. If LowerValue or UpperValue changed, the Scale should repaint. So I add

public static readonly DependencyProperty LowerValueProperty =
  RangeSlider.LowerValueProperty.AddOwner(typeof(Scale), new FrameworkPropertyMetadata(1d));

When I move the thumb, something should raised in Scale. First I implemented OnRender(DrawingContext) and added to the LowerValueProperty in RangeSlider FrameworkPropertyMetadataOptions. But it doesn’t matter, nothing happens. Moreover I do not want to use OnRender(DrawingContext), because it’s not available in Silverlight.

Furthermore I wonder why the OnLowerValueChanged-Method in RangeSlider is raised but not the setter of LowerValue (at least the debugger does not break in there).

So, is there a way for Silverlight & WPF to raise a method automatically in Scale, when LowerValue in RangeSlider changed (except raising from OnLowerValueChanged)?

Note: The above code is the WPF-Code. In Silverlight there are of course some difference, because Silverlight does not support among other things Coercion.
Because the code should run in Silverlight and WPF, I do not want to use OnRender(DrawingContext).

  • 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-23T18:07:10+00:00Added an answer on May 23, 2026 at 6:07 pm

    If I understand correctly you want to be able to perform some logic in propertiers, that are just wrappers around GetValue & SetValue methods. Problem is they are only used when you create XAML and specify bindings for those properties. Behind the scenes they are never called anymore, instead GetValue & SetValue are used.

    Thats why I think (still not sure I understand question clearly) you have to either use event handlers for ValueChanged event (for example) inside your control and there is no other way to intercept calls to GetValue & SetValue.

    Or you can use PropertyChangedCallback with DependencyProperties that is called after DPs are changed and place your code there

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

Sidebar

Related Questions

I need to implement version control, even for just the developing I do at
I need to implement auto-capitalization inside of a Telerik RadEditor control on an ASPX
I have a simulation written in C++ in which I need to maintain a
i have a input tag which is non editable, but some times i need
I have a page on my site which has a list of things which
I have a need to build a string from Last Name, First Name, Middle
I need to implement a scroll view which (on a button press) will page
I need to implement mouse drag events which look something like this: class MouseDragEvent
I need to implement a Diff algorithm in VB.NET to find the changes between
I need to implement a 4-to-1 function in Veriog. The input is 4 bits,

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.