<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.ListBoxPage"
    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:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">

    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="A ListBox with items defined inline and its width set.">
                <StackPanel HorizontalAlignment="Left">
                    <ListBox
                        x:Name="ListBox1"
                        Width="200">
                        <sys:String>Blue</sys:String>
                        <sys:String>Green</sys:String>
                        <sys:String>Red</sys:String>
                        <sys:String>Yellow</sys:String>
                    </ListBox>
                    <Rectangle
                        Fill="{Binding ElementName=ListBox1, Path=SelectedItem}"
                        Height="30"
                        Width="100"
                        Margin="0,10,0,0" />
                </StackPanel>
            </sc:ControlExample>
            <sc:ControlExample
                x:Name="Example2"
                HeaderText="A ListBox with its ItemsSource and Height set."
                HorizontalContentAlignment="Stretch">
                <sc:ControlExample.Example>
                    <StackPanel>
                        <ListBox
                            x:Name="ListBox2"
                            ItemsSource="{Binding Fonts}"
                            DisplayMemberPath="Item1"
                            SelectedValuePath="Item2"
                            SelectedIndex="2"
                            Height="164" />
                        <TextBlock
                            x:Name="Control2Output"
                            Text="You can set the font used for this text."
                            FontFamily="{Binding ElementName=ListBox2, Path=SelectedValue}"
                            Style="{StaticResource OutputTextBlockStyle}" />
                    </StackPanel>
                </sc:ControlExample.Example>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
