Found Alternate row color in Listbox and used Bind foreground of Textblock. Realized I needed to make a class to hold my string and color. Put that class in an ObservableCollection, and bind to the ObservableCollection.
My new class:
public class DisplayData
{
public string _string { get; set; }
public System.Windows.Media.Brush _color { get; set; }
public int _fontSize { get; set; }
}
XAML:
<ListBox x:Name="Progress_Window" ItemsSource="{Binding pb._displayString}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding _string}" Foreground="{Binding _color}" FontSize="{Binding _fontSize}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Where pb is my local class variable in my VM.
Code in Model:
public ObservableCollection<DisplayData> _displayString { get; set; }
...
_displayString = new ObservableCollection<DisplayData>();
string _error = "Error Opening COM Port";
_displayString.Add(new DisplayData { _string = _error, _color = System.Windows.Media.Brushes.Red, _fontSize = 20 });
solved How to make a Progress/Message Window where each line can be different font, size, color?