<UserControl x:Class="WPFBeginner.Controls.InputPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Name="Root">

    <StackPanel>
        <StackPanel Orientation="Horizontal">
            <Label Content="{Binding LabelText, ElementName=Root}"
                   Style="{DynamicResource DefaultLabelStyle}"/>
            <TextBlock Text="*"
                       Foreground="{DynamicResource ErrorBrush}"
                       Visibility="{Binding IsRequired, ElementName=Root, Converter={StaticResource BoolToVisibilityConverter}}"
                       Margin="2,0,0,0"
                       VerticalAlignment="Center"/>
        </StackPanel>
        <TextBox Text="{Binding Text, ElementName=Root, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                 Style="{DynamicResource DefaultTextBoxStyle}"/>
    </StackPanel>
</UserControl>
