<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.ExpanderPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">
    <Grid>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ExpandDirectionStates">
                <VisualState x:Name="Down" />
                <VisualState x:Name="Up">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="expander" Storyboard.TargetProperty="(DockPanel.Dock)">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Dock.Bottom}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="expander" Storyboard.TargetProperty="VerticalAlignment">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static VerticalAlignment.Bottom}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Left" />
                <VisualState x:Name="Right" />
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <ScrollViewer>
            <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
                <sc:ControlExample
                    HeaderText="A simple expander."
                    HorizontalContentAlignment="Stretch"
                    VerticalContentAlignment="Stretch">
                    <DockPanel>
                        <Expander
                            x:Name="expander"
                            Header="My Expander"
                            ExpandDirection="Down"
                            IsExpanded="True"
                            VerticalAlignment="Top">
                            <TextBlock TextWrapping="Wrap">
                                Lorem ipsum dolor sit amet, consectetur
                                adipisicing elit, sed do eiusmod tempor incididunt ut
                                labore et dolore magna aliqua
                            </TextBlock>
                        </Expander>
                    </DockPanel>

                    <sc:ControlExample.Options>
                        <ui:RadioButtons
                            Header="ExpandDirection"
                            ItemsSource="{Binding Converter={StaticResource EnumValuesConverter}, Source={x:Type ExpandDirection}}"
                            SelectedItem="{Binding ExpandDirection, ElementName=expander}"
                            SelectionChanged="ExpandDirection_SelectionChanged" />
                    </sc:ControlExample.Options>
                </sc:ControlExample>
            </ui:SimpleStackPanel>
        </ScrollViewer>
    </Grid>
</ui:Page>
