的問題是,我需要改變標籤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