I have to create listBox via code behind. After that I have to change the colour that the selected item has when the listbox is not selected. I have found that solution but am not able to render it via code behind.
Thank you
Very easy if it's ok for you overriding the windows colour on the listbox
listBox1.Resources[SystemColors.InactiveSelectionHighlightBrushKey] = Brushes.Blue;
I picked your rgb colour so to be precise it's:
listBox1.Resources[SystemColors.InactiveSelectionHighlightBrushKey] = new SolidColorBrush(Color.FromArgb(255, (byte)51, (byte)153, (byte)255));