What FontFamily Fonts can I use in a ListBox?
I'm trying to change the FontFamily
of a ListBox
to a fixed-width font, but I don't know what's available. Here's what I have:
<ListBox Margin="12,55,12,12" Name="listBox1" FontFamily="Arial" />
When I try something like FontFamily="Courier"
, it won't show up as Courier, which leads me to believe that font may not be available. I've tried searching for the last 10 minutes, but I can't find a list of开发者_开发技巧 fonts that I can use by default in WPF.
Try Courier New
.
Courier is a raster font, and raster fonts are not supported by WPF.
Courier New is a TrueType font, so it should work fine.
The easiest way to check for a specific font is to look in the Font dropdown in Word.
Raster fonts such as Courier will have a pixelated printer icon; TrueType fonts will have a TT or an O.
EDIT:
In answer to your comment, WPF can use any font installed on the end-user's system.
Here is a list of fonts included with each version of Windows. These fonts will always be available. If you want to use a different font, you'll have to distribute it with your app. (And check the font's license terms)
精彩评论