Windows Phone -画笔不存在
本文关键字:不存在 画笔 Phone Windows | 更新日期: 2023-09-27 18:14:55
我想改变我的按钮的前景,但我得到一个错误说"名称'Brushes'不存在于当前上下文中"
代码如下:
private void AddButton_Click(object sender, RoutedEventArgs e)
{
Button but = new Button();
but.Content = "Task";
but.Background = (SolidColorBrush)Application.Current.Resources["PhoneAccentColor"];
but.Foreground = Brushes.Blue; //error here
TaskPanel.Children.Add(but);
}
加上,使用系统。绘图不起作用。我尝试了几种替代方案,但我的应用程序也无法识别windows . ui . color
答案:
but.Foreground = new SolidColorBrush(Colors.Orange);