<UserControl
  x:Class="VideoDistanc.LoginUI.LoginStatus" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d">

    <Grid x:Name="LayoutRoot">
        <vsm:VisualStateManager.VisualStateGroups>
            <vsm:VisualStateGroup x:Name="loginStates">
                <vsm:VisualState x:Name="windowsAuth">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="loginControls" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.0000000">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="logoutButton" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.0000000">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="loggedIn">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="loginControls" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.0000000">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="loggedOut">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="logoutControls" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.0000000">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </vsm:VisualState>
            </vsm:VisualStateGroup>
        </vsm:VisualStateManager.VisualStateGroups>

        <StackPanel x:Name="loginControls" Style="{StaticResource LoginPanelStyle}">
            <Button x:Name="loginButton" Content="{Binding Path=ApplicationStrings.LoginButton, Source={StaticResource ResourceWrapper}}" 
               Click="LoginButton_Click" Style="{StaticResource LoginRegisterLinkStyle}"/>
        </StackPanel>

        <StackPanel x:Name="logoutControls" Style="{StaticResource LoginPanelStyle}">
            <!-- welcomeText.Text property's binding is setup in code-behind -->
            <TextBlock x:Name="welcomeText" Style="{StaticResource WelcomeTextStyle}"/>
            <TextBlock Text="  |  " Style="{StaticResource SpacerStyle}"/>
            <Button x:Name="logoutButton" Content="{Binding Path=ApplicationStrings.LogOffButton, Source={StaticResource ResourceWrapper}}" 
                                    Click="LogoutButton_Click" 
                                    Style="{StaticResource LoginRegisterLinkStyle}" 
                                    IsEnabled="{Binding Path=Authentication.IsLoggingOut, Converter={StaticResource NotOperatorValueConverter}}" />
        </StackPanel>
    </Grid>

</UserControl>