Q:

WPF convert boolean to colored string

I stucked with "simple" converting. I have a method. It checks connection. If connection established it change boolean property of my viewmodel. What I want to do, is to display colored string on my form (red-colored "Connection failed" or green-colored "Connection established" depending on boolean property) but i don't have any idea how to do it.

A:

Use below(change control type with what you are using):
<TextBox Text="content" >
    <TextBox.Style>
        <Style TargetType="TextBox">
            <Style.Triggers>
                <DataTrigger Binding="{Binding ConnectionStatus}" Value="true">
                    <Setter Property="Background" Value="Red"></Setter>
                </DataTrigger>
                <DataTrigger Binding="{Binding ConnectionStatus}" Value="false">
                    <Setter Property="Background" Value="Green"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </TextBox.Style>
</TextBox>

A:

You have two options here, for both of which I will simply provide some resources as you did not provide any specific code:
The first option is to update the property of the text using a trigger. This would be implemented in xaml and simply watched the bound property to take a specific value (in you case true or false) and updates the color accordingly. This is also what @Kylo-Ren did.
Information about this can for example be found here:
http://www.wpf-tutorial.com/styles/trigger-datatrigger-event-trigger/
The other option is to use the IValueConverter interface and convert the boolean to a color. This is what @Stefan did. More info here:
http://www.codeproject.com/Tips/868163/IValueConverter-Example-and-Usage-in-WPF
I would recommend the first version if you only have a very limited range of values that the property can take and/or you want to update multiple visual properties at once.
The second version works better for more complex conversions (like converting a complete object to a formatted string) but can not be easily used to update multiple visual properties.
Rule of thumb: 
I want to indicate a state => use Trigger
I want to display an objects value in a specific way (e.g. Text) => use IValueConverter

