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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:42:24+00:00 2026-05-16T11:42:24+00:00

I wish to customize the appearance of the basic WPF TickBar . I was

  • 0

I wish to customize the appearance of the basic WPF TickBar. I was wondering if there was a simple way to do this using a control template:

I wish to have numbers in place of ticks along the tickbar. I want the position of the number to correspond to the value of a slider (much like the picture in the link).

I’ve searched around and one suggestion I found said to create a class that inherits from TickBar and override it’s OnRender method.

I’d much rather find a solution that doesn’t involve that. I was really hoping using a control template would do the trick. So, If there is one such solution, suggestions would be greatly appreciated! 🙂

  • 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-16T11:42:24+00:00Added an answer on May 16, 2026 at 11:42 am

    Okay, I have a solution. I figured I should answer my question in the event some other fellow along the line runs into the same situation as I. 🙂

    Override OnRender seems to be the most obvious solution. I was really hoping to use a template of sorts…sigh …ah well. Anyways, I ran across this discussion on MSDN’s forums which provided an answer to send me in the right direction.

    Simple, and it need a few tweeks to make it more flexible, so here’s my version:

    class CustomTickBar : TickBar
    {
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            double num = this.Maximum - this.Minimum;
            double y = this.ReservedSpace * 0.5;
            FormattedText formattedText = null;
            double x = 0;
            for(double i = 0; i <= num; i += this.TickFrequency)
            {
                formattedText = new FormattedText(i.ToString(), FlowDirection.LeftToRight, 
                    new Typeface("Verdana"), 8, Brushes.Black);
                if(this.Minimum == i)
                    x = 0;
                else
                    x += this.ActualWidth / (num / this.TickFrequency) ;
                dc.DrawText(formattedText, new Point(x, 10)); 
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish Subversion had a better way of moving tags. The only way that
I wish to know all the pros and cons about using these two methods.
I am using a tab bar (UITabBarController) on my app and I wish to
There're a few entities that we wish to hide its exact ID from the
I have been using subprocess.Popen successfully in the past, when wrapping binaries with a
I wish to have a transluscent background for an activity, so that the previous
I wish to implement a 2d bit map class in Python. The class would
I wish to implement my software on a shareware basis, so that the user
I wish I were a CSS smarty .... How can you place a div
I wish to search a database table on a nullable column. Sometimes the value

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.