[UWP]从代码更改按钮文本属性 [英] [UWP]Change Button Text Properties from code
问题描述
您好,
我正在尝试更改UWP应用程序中文本文件的按钮文本属性。
我已经能够成功设置大多数属性但是我无法使Color属性起作用。
我需要从文件中读取颜色然后更改新颜色按钮的前景色。
例如:
"大" :[
{
" FontSize" :40,
" FontFace" :"Helvetica",
" FontColor" :"黑色"
}]
这是正在读取的JSON文件的片段。
我可以让Size和Face工作,但不能使用这个颜色:
NameText.Text = labels。 ROOMNAME;
NameText.FontSize = _font.HeaderFontSize_LG;
NameText.FontFamily = new FontFamily(_font.HeaderFontFace_LG);
buti无法使颜色生效。我已经谷歌搜索了几个小时,找不到可行的解决方案。
任何帮助将不胜感激。
嗨CMCTS,
会不会这个解决方案适合你?
此致,
IoTGirl
Hello,
I am trying to change a buttons Text properties from a text file in a UWP application.
I have been able to set most properties successfully however I cannot get the Color property to work.
I need to read the color from file and then change the foreground color of the button from the new color.
For example:
"Large" : [
{ "FontSize" : 40, "FontFace" : "Helvetica", "FontColor" : "Black" }
]
this is a snippet from the JSON file that is being read.
I can get the Size and Face to work but cant get the color to work with this:
NameText.Text = labels.RoomName; NameText.FontSize = _font.HeaderFontSize_LG; NameText.FontFamily = new FontFamily(_font.HeaderFontFace_LG);
buti cannot get the color to work. I have been Googling for hours and cannot find a working solution.
Any help would be greatly appreciated.
Hi CMCTS,
Would this solution work for you?
Sincerely,
IoTGirl
这篇关于[UWP]从代码更改按钮文本属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!