<Window x:Class="ServerManagerTool.Plugin.Discord.Windows.VersionFeedWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ServerManagerTool.Plugin.Discord"
        MinWidth="400" MinHeight="400" Width="640" Height="480" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" ResizeMode="CanResizeWithGrip"
        Loaded="VersionFeedWindow_Loaded"
        Icon="../Art/favicon.ico" Title="{DynamicResource VersionFeedWindow_Title}">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/ServerManager.Plugin.Discord;component/Globalization/en-US/en-US.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="Version" TargetType="Label">
                <Setter Property="Content" Value="{Binding Title}"/>
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="Foreground" Value="Black"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsCurrent}" Value="True">
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="Foreground" Value="#0066CC"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </Window.Resources>
    
    <Grid Background="{DynamicResource GradientBackground}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Margin="5,5,0,0" Content="{DynamicResource VersionFeedWindow_VersionFilterLabel}"/>
        <ComboBox  Grid.Row="0" Grid.Column="1" Margin="5,5,5,0" ItemsSource="{Binding FeedEntries}" SelectedValue="{Binding SelectedFeedEntry}" ToolTip="{DynamicResource VersionFeedWindow_VersionFilterTooltip}">
            <ComboBox.ItemContainerStyle>
                <Style TargetType="{x:Type ComboBoxItem}" >
                    <Setter Property="Height" Value="20" />
                </Style>
            </ComboBox.ItemContainerStyle>

            <ComboBox.ItemTemplate>
                <DataTemplate DataType="{x:Type local:VersionFeedEntry}">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                        <Label Padding="0,-1,0,-1" VerticalAlignment="Center" Style="{DynamicResource Version}"/>
                        <TextBlock Text="{Binding Updated, StringFormat= - {0:G}}" Margin="5,0,0,0" Padding="0,-1,0,-1" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <WebBrowser Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" local:BrowserBehavior.Html="{Binding SelectedFeedEntry.Content}"/>
    </Grid>
</Window>
