dimanche 10 mai 2015

How to change the border color of combo box by c# code?

I have style of combobox and i want to change Border Brush Color of combo box by c# code ,here the xaml code of combo box border brush

 <Border Grid.ColumnSpan="2" Name="Border"
          BorderBrush="#e3e9ef" 
          CornerRadius="0" BorderThickness="1, 1, 1, 1" 
          Background="{StaticResource ComboBoxNormalBackgroundBrush}" /> 

I set name of border and i want to change it by code here is my c# code

 Border  myBorder1 = new Border();
              myBorder1.FindName("Border");
              myBorder1.BorderBrush = new SolidColorBrush(Color.FromRgb(255, 0, 0));

the problem is the code it's bot working can any one help me for change the border color please.

Aucun commentaire:

Enregistrer un commentaire