的问题是,我需要改变标签fontWeight设置和FontStyle以编程方式,但似乎没有任何工作......这是我到目前为止已经试过:更改标签属性编程
label.FontWeight = FontWeight.FromOpenTypeWeight(99);
对于label.FontStyle我不知道,我卡在这里:
label.FontStyle = new FontStyle();
我不知道该从哪里做什么。我疯狂搜索,但一无所获。
在此先感谢您的任何建议!
的问题是,我需要改变标签fontWeight设置和FontStyle以编程方式,但似乎没有任何工作......这是我到目前为止已经试过:更改标签属性编程
label.FontWeight = FontWeight.FromOpenTypeWeight(99);
对于label.FontStyle我不知道,我卡在这里:
label.FontStyle = new FontStyle();
我不知道该从哪里做什么。我疯狂搜索,但一无所获。
在此先感谢您的任何建议!
对于FontStyle,您可以在代码隐藏中使用FontStyles类,对于FontWeight使用FontWeights。
private void Button_Click(object sender, RoutedEventArgs e)
{
uiLabel.FontWeight = FontWeights.Bold;
uiLabel.FontStyle = FontStyles.Italic;
}
看看this SO question。它本身并没有帮助标签,但它确实允许您使用TextBlock控件更改文本的属性。
工作!谢谢! – Carlo 2009-06-03 22:50:30