How to set dynamic foreground property for combox?

I am developing an application for Windows Phone 7. I am new to silver light. In my application, I need a dynamic combobox. Therefore, I use the following code

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);

In the above code, I do not know how to set the right side of the following statement

CurrenciesCombobox.Foreground = ;

Could you tell me how to set the Foreground property for combobx? Can you provide me with any code or link through which I can solve the above problem? If I am doing something wrong, then please guide me.

+3
source share
2 answers

White, :

CurrenciesCombobox.Foreground = new SolidColorBrush(Colors.White);

:

CurrenciesCombobox.Foreground = new SolidColorBrush(new Color()
{
    A = 255 /*Opacity*/,
    R = 255 /*Red*/,
    G = 255 /*Green*/,
    B = 255 /*Blue*/
});

.

: Brushes in Silverlight.

, Windows Phone 7 . .

+8

CurrenciesCombobox.Foreground = (Brush)Application.Current.Resources["PhoneAccentBrush"];

,

Windows Phone

CurrenciesCombobox.Foreground = new SolidColorBrush(Colors.Red);
+4

Source: https://habr.com/ru/post/1781640/


All Articles