6

I need some minor text formatting control in my application, I have got a font family ComboBox working fine, which was a simple exercise achieved in just XAML but now I wanted to fill the font size ComboBox with default font sizes.

Obviously most applications like Word, Outlook etc have this kind of interface for selecting font size with default like:

8
9
10
11
12
14
..
72

Now I can implement something to provide these numbers easily enough, I was just wondering if there was a framework method which would provided them for me seeing as I'm using the framework to populate the font families ComboBox?

Many Thanks

Paul

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Paulie Waulie
  • 1,690
  • 13
  • 23
  • See http://stackoverflow.com/questions/3444371/converting-between-wpf-font-size-and-standard-font-size and http://stackoverflow.com/questions/139655/convert-pixels-to-points – Phil Mar 15 '12 at 11:00
  • He wants a list with available sizes not a conversion from one size type to another. – EricSchaefer Mar 15 '12 at 11:03
  • Why would you need there to be a default list of FontSizes? – Silvermind Mar 15 '12 at 11:03
  • @Silvermind I don't "need" them, I'm just offering common functionality and as I put in the question I thought there may be a chance that as this is quite standard the framework might have offered it like with font families. – Paulie Waulie Mar 15 '12 at 11:07

1 Answers1

2

I'd say these values are arbitrary. Just generate your own list.

EricSchaefer
  • 25,272
  • 21
  • 67
  • 103
  • Yeah, that was my inital thought and I started to do that, just wanted to check to see if there was a framework method for this already that I couldn't find any documentation about, I'd guessed not but StackOverflow often highlights some secrets. Thanks for your response. – Paulie Waulie Mar 15 '12 at 11:09
  • 1
    I wouldn't be so sure. The same numbers appear in quite a lot of MS products. Would you say they hardcode it everytime? MS is smarter than that in my experience. – Louis Kottmann Mar 15 '12 at 11:10
  • I couldn't find anything which I was slightly surprised about but I followed Eric's and initial thought and simply generated the numbers myself. Thanks Eric for the answer. – Paulie Waulie Mar 27 '12 at 13:17