<Window x:Class="SyncTrayzor.Pages.ThirdPartyComponentsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="https://github.com/canton7/Stylet"
        xmlns:l="clr-namespace:SyncTrayzor.Localization"
        Title="{l:Loc ThirdPartyComponentsView_Title}" Height="700" Width="600"
        MinHeight="500" MinWidth="400"
        FlowDirection="{x:Static l:Localizer.FlowDirection}">
    <DockPanel Margin="10">
        <TextBlock DockPanel.Dock="Top" Margin="0,10,0,10" TextWrapping="Wrap" Text="{l:Loc ThirdPartyComponentsView_Intro}"/>

        <Button DockPanel.Dock="Bottom"
                HorizontalAlignment="Right"
                Margin="0,10,0,0"
                Command="{s:Action RequestClose}"
                IsDefault="True"
                IsCancel="True"
                Content="{l:Loc Generic_Dialog_Close}"
                Style="{StaticResource DialogButton}"/>

        <TabControl ItemsSource="{Binding Items}" SelectedItem="{Binding ActiveItem}" DisplayMemberPath="Name">
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <DockPanel Margin="10">
                        <Grid DockPanel.Dock="Top">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                        
                            <Grid.Resources>
                                <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                    <Style.Triggers>
                                        <Trigger Property="Grid.Column" Value="0">
                                            <Setter Property="FontWeight" Value="Bold"/>
                                            <Setter Property="Margin" Value="0,0,10,0"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Grid.Resources>

                            <TextBlock Grid.Column="0" Grid.Row="0" Text="{l:Loc ThirdPartyComponentsView_ComponentNameLabel}"/>
                            <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Name}"/>

                            <TextBlock Grid.Column="0" Grid.Row="1" Text="{l:Loc ThirdPartyComponentsView_ComponentDescriptionLabel}"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Description}"/>

                            <TextBlock Grid.Column="0" Grid.Row="2" Text="{l:Loc ThirdPartyComponentsView_ComponentHomepageLabel}"/>
                            <TextBlock Grid.Column="1" Grid.Row="2">
                                <Hyperlink Command="{s:Action ViewHomepage}">
                                    <TextBlock Margin="0" Text="{Binding Homepage}" FontWeight="Normal"/>
                                </Hyperlink>
                            </TextBlock>

                            <TextBlock Grid.Column="0" Grid.Row="3" Text="{l:Loc ThirdPartyComponentsView_ComponentLicenseLabel}"/>
                            <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding License}"/>

                            <TextBlock Grid.Column="0" Grid.Row="4" Text="{l:Loc ThirdPartyComponentsView_ComponentNotesLabel}"/>
                            <TextBlock Grid.Column="1" Grid.Row="4" Text="{Binding Notes}"/>
                        </Grid>

                        <TextBlock DockPanel.Dock="Top" Margin="0,5,0,0" FontWeight="Bold" Text="{l:Loc ThirdPartyComponentsView_ComponentLicenseTextLabel}"/>
                        <TextBox IsReadOnly="True" Text="{Binding LicenseText}"
                                 ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                 ScrollViewer.VerticalScrollBarVisibility="Auto"
                                 TextWrapping="WrapWithOverflow"/>
                    </DockPanel>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </DockPanel>
</Window>
