Sha*_*wal 3 c# silverlight combobox windows-phone-7
我正在开发windows phone 7应用程序.我是银光的新手.在我的应用程序中,我需要一个动态组合框.所以我使用以下代码
ComboBox CurrenciesCombobox = null;
CurrenciesCombobox = new ComboBox();
CurrenciesCombobox.Name = "CurrencyCombobox";
CurrenciesCombobox.SetValue(Canvas.TopProperty, 10.00);
CurrenciesCombobox.SetValue(Canvas.LeftProperty, 10.00);
CurrenciesCombobox.Margin = new Thickness(235, 395, 139, 180);
//CurrenciesCombobox.Foreground = ;
CurrenciesCombobox.ItemsSource = Currencies;
CurrenciesCombobox.SelectionChanged += new SelectionChangedEventHandler(CurrenciesCombobox_SelectionChanged);
ContentPanel.Children.Add(CurrenciesCombobox);
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我不知道如何设置以下语句的右侧
CurrenciesCombobox.Foreground = ;
Run Code Online (Sandbox Code Playgroud)
你能告诉我如何设置combobx的Foreground属性吗?能否请您提供我可以解决上述问题的任何代码或链接?如果我做错了什么,请指导我.
要将其设置为White,请使用以下代码:
CurrenciesCombobox.Foreground = new SolidColorBrush(Colors.White);
Run Code Online (Sandbox Code Playgroud)
与以下相同:
CurrenciesCombobox.Foreground = new SolidColorBrush(new Color()
{
A = 255 /*Opacity*/,
R = 255 /*Red*/,
G = 255 /*Green*/,
B = 255 /*Blue*/
});
Run Code Online (Sandbox Code Playgroud)
第二种方法提供了更大的灵活性
还有其他类型的画笔:Brushes in Silverlight.
此外,在使用时Windows Phone 7,您应该考虑使用主题颜色.看看可用的主题资源.
| 归档时间: |
|
| 查看次数: |
4076 次 |
| 最近记录: |