<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
    xmlns:local="using:Bili.App.Controls">
    <Style TargetType="local:PlayerTip">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:PlayerTip">
                    <Grid
                        x:Name="RootGrid"
                        MinWidth="240"
                        Padding="16,12"
                        Background="{ThemeResource MediaTransportControlsPanelBackground}"
                        ColumnSpacing="4"
                        CornerRadius="{StaticResource ControlCornerRadius}"
                        RowSpacing="8"
                        Visibility="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=IsOpen, Converter={StaticResource BoolToVisibilityConverter}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <StackPanel Orientation="Horizontal" Spacing="4">
                            <TextBlock
                                x:Name="TitleBlock"
                                Style="{StaticResource CaptionTextBlockStyle}"
                                HorizontalAlignment="Left"
                                FontWeight="Bold"
                                Text="{TemplateBinding Title}"
                                TextTrimming="CharacterEllipsis" />
                            <TextBlock
                                Style="{StaticResource CaptionTextBlockStyle}"
                                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                Text="{TemplateBinding AdditionalTitle}" />
                        </StackPanel>

                        <TextBlock
                            x:Name="MessageBlock"
                            Style="{StaticResource CaptionTextBlockStyle}"
                            Grid.Row="1"
                            Grid.ColumnSpan="2"
                            MaxWidth="320"
                            Margin="0,-4,0,0"
                            HorizontalAlignment="Left"
                            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                            MaxLines="2"
                            Text="{TemplateBinding Message}"
                            TextWrapping="Wrap">
                            <ToolTipService.ToolTip>
                                <ToolTip Content="{TemplateBinding Message}" IsEnabled="{Binding ElementName=MessageBlock, Path=IsTextTrimmed}" />
                            </ToolTipService.ToolTip>
                        </TextBlock>
                        <Button
                            x:Name="ActionButton"
                            Style="{StaticResource AccentButtonStyle}"
                            Grid.Row="2"
                            Grid.ColumnSpan="2"
                            HorizontalAlignment="Left"
                            BorderThickness="0"
                            Command="{TemplateBinding Command}"
                            Content="{TemplateBinding ActionContent}"
                            FontSize="12" />
                        <Button
                            x:Name="CloseButton"
                            Grid.Column="1"
                            Padding="4"
                            BorderThickness="0"
                            Command="{TemplateBinding CloseCommand}">
                            <FontIcon
                                FontFamily="{StaticResource SymbolThemeFontFamily}"
                                FontSize="12"
                                Glyph="&#xE10A;" />
                        </Button>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
