<UserControl
    x:Class="ControlCatalog.Pages.ComboBoxPage"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:col="using:System.Collections"
    xmlns:sys="using:System">
    <StackPanel Orientation="Vertical" Spacing="4">
        <TextBlock Classes="h2">A drop-down list.</TextBlock>

        <StackPanel
            Margin="0,16,0,0"
            HorizontalAlignment="Center"
            Orientation="Horizontal"
            Spacing="8">
            <WrapPanel
                MaxWidth="660"
                Margin="0,16,0,0"
                HorizontalAlignment="Center">
                <WrapPanel.Styles>
                    <Style Selector="ComboBox">
                        <Setter Property="Width" Value="250" />
                        <Setter Property="Margin" Value="10" />
                    </Style>
                </WrapPanel.Styles>

                <ComboBox PlaceholderText="Pick an Item" WrapSelection="{Binding WrapSelection}">
                    <ComboBoxItem>Inline Items</ComboBoxItem>
                    <ComboBoxItem>Inline Item 2</ComboBoxItem>
                    <ComboBoxItem>Inline Item 3</ComboBoxItem>
                    <ComboBoxItem>Inline Item 4</ComboBoxItem>
                </ComboBox>

                <ComboBox WrapSelection="{Binding WrapSelection}">
                    <ComboBox.Items>
                        <col:ArrayList>
                            <x:Null />
                            <sys:String>Hello</sys:String>
                            <sys:String>World</sys:String>
                        </col:ArrayList>
                    </ComboBox.Items>
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Panel>
                                <TextBlock Text="{Binding}" />
                                <TextBlock IsVisible="{Binding Converter={x:Static ObjectConverters.IsNull}}" Text="Null object" />
                            </Panel>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>

                <ComboBox SelectedIndex="0" WrapSelection="{Binding WrapSelection}">
                    <ComboBoxItem>
                        <Panel>
                            <Rectangle Fill="{DynamicResource SystemAccentColor}" />
                            <TextBlock Margin="8">Control Items</TextBlock>
                        </Panel>
                    </ComboBoxItem>
                    <ComboBoxItem>
                        <Ellipse
                            Width="50"
                            Height="50"
                            Fill="Yellow" />
                    </ComboBoxItem>
                    <ComboBoxItem>
                        <TextBox Text="TextBox" />
                    </ComboBoxItem>
                </ComboBox>

                <ComboBox
                    x:Name="fontComboBox"
                    SelectedIndex="0"
                    WrapSelection="{Binding WrapSelection}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock FontFamily="{Binding}" Text="{Binding Name}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>

                <ComboBox PlaceholderText="Pick an Item" WrapSelection="{Binding WrapSelection}">
                    <ComboBoxItem>Inline Items</ComboBoxItem>
                    <ComboBoxItem>Inline Item 2</ComboBoxItem>
                    <ComboBoxItem>Inline Item 3</ComboBoxItem>
                    <ComboBoxItem>Inline Item 4</ComboBoxItem>
                    <DataValidationErrors.Error>
                        <sys:Exception />
                    </DataValidationErrors.Error>
                </ComboBox>

                <ComboBox PlaceholderText="Scaled" Width="166" RenderTransformOrigin="0,0">
                    <ComboBox.RenderTransform>
                      <ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
                    </ComboBox.RenderTransform>
                    <ComboBoxItem>Inline Items</ComboBoxItem>
                    <ComboBoxItem>Inline Item 2</ComboBoxItem>
                    <ComboBoxItem>Inline Item 3</ComboBoxItem>
                    <ComboBoxItem>Inline Item 4</ComboBoxItem>
                </ComboBox>
            </WrapPanel>

            <CheckBox IsChecked="{Binding WrapSelection}">WrapSelection</CheckBox>

        </StackPanel>
    </StackPanel>
</UserControl>
