How do I Change the FontFamily on a ContentPresenter?

a 夏天 提交于 2019-11-29 22:52:12

You need to use the FontWeight property to specify a bold font. However, you've probably noticed that ContentPresenter doesn't have that property. So you'll need to use the TextBlock.FontWeight attached property to tell the ContentPresenter that any text inside it should be bold.

Try this:

<ContentPresenter TextBlock.FontFamily="Tahoma"
                  TextBlock.FontWeight="Bold"
                  SnapsToDevicePixels="True"
                  HorizontalAlignment="Left"
                  Margin="4,0,0,0"
                  ContentSource="Header"
                  VerticalAlignment="Center"
                  RecognizesAccessKey="True" />

I can't help about Silverlight, but in the new WPF 4 it is TextElement rather than TextBlock

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!