<UserControl x:Class="MainShell.ParaSetting.View.CameraParameterView"
             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:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mw="http://www.maxwell-gp.com/"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="CameraParameterLabelStyle" TargetType="Label" BasedOn="{StaticResource ProcessLabelStyle}">
                <Setter Property="Width" Value="78"/>
            </Style>

            <Style x:Key="CameraParameterNumberBoxStyle" TargetType="{x:Type mw:NumberBox}" BasedOn="{StaticResource ProcessLargeNumberBoxStyle}">
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>

            <Style x:Key="CameraParameterCardGroupBoxStyle" TargetType="GroupBox" BasedOn="{StaticResource ProcessCardGroupBoxStyle}">
                <Setter Property="Width" Value="320"/>
                <Setter Property="Margin" Value="0,0,18,18"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Background="{StaticResource ProcessPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="60"/>
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0"
                      Margin="4,4,4,0"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Disabled"
                      Padding="0,0,4,0">
            <StackPanel Margin="0,0,0,4">
                <GroupBox Header="{DynamicResource FovPara}" Style="{StaticResource ProcessWideCardGroupBoxStyle}">
                    <ItemsControl ItemsSource="{Binding CameraItems}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <GroupBox Header="{Binding CameraName}" Style="{StaticResource CameraParameterCardGroupBoxStyle}">
                                    <StackPanel>
                                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                            <Label Style="{StaticResource CameraParameterLabelStyle}" Content="{DynamicResource FovX}"/>
                                            <mw:NumberBox Style="{StaticResource CameraParameterNumberBoxStyle}" Value="{Binding FovX, UpdateSourceTrigger=PropertyChanged}" mw:NumericKeypadAttach.IsEnabled="True"/>
                                        </StackPanel>
                                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                            <Label Style="{StaticResource CameraParameterLabelStyle}" Content="{DynamicResource FovY}"/>
                                            <mw:NumberBox Style="{StaticResource CameraParameterNumberBoxStyle}" Value="{Binding FovY, UpdateSourceTrigger=PropertyChanged}" mw:NumericKeypadAttach.IsEnabled="True"/>
                                        </StackPanel>
                                    </StackPanel>
                                </GroupBox>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </GroupBox>
            </StackPanel>
        </ScrollViewer>

        <Grid Grid.Row="1" Margin="4,8,4,4">
            <Button Content="{DynamicResource Save}" Click="{mw:Action BtnSave}" Style="{StaticResource SaveButtonStyle}" HorizontalAlignment="Right"/>
        </Grid>
    </Grid>
</UserControl>
