<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FolderButton3"
             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"
             mc:Ignorable="d" d:DesignWidth="128" d:DesignHeight="192"
             d:DataContext="{d:DesignInstance Type=vm:TreeItem, IsDesignTimeCreatable=False}"
             xmlns:vm="clr-namespace:FModel.ViewModels"
             xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
             xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
             Width="128" Height="192"
             Background="{DynamicResource {x:Static adonisUi:Brushes.Layer4BackgroundBrush}}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="2" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Viewbox Grid.Row="0" Height="128">
            <Canvas Width="128" Height="128">
                <Canvas.Resources>
                    <LinearGradientBrush x:Key="TabGradient" StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#c9975f" Offset="0" />
                        <GradientStop Color="#b28c53" Offset="0.5" />
                        <GradientStop Color="#a67f47" Offset="1" />
                    </LinearGradientBrush>

                    <LinearGradientBrush x:Key="BodyGradient" StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#d4ae75" Offset="0" />
                        <GradientStop Color="#c9a167" Offset="0.3" />
                        <GradientStop Color="#b89456" Offset="1" />
                    </LinearGradientBrush>
                </Canvas.Resources>

                <Path Fill="{StaticResource TabGradient}" Data="M16.0018 36l0 -0.0701281 -0.00162402 -6.66681c-0.00509351,-0.616462 0.113829,-1.21757 0.342594,-1.77092 0.231423,-0.559917 0.572171,-1.07266 1.00696,-1.50532 0.433169,-0.431029 0.945252,-0.767794 1.50347,-0.997075 0.565823,-0.232308 1.16664,-0.355291 1.76937,-0.355291l21.1332 0c0.951601,0 1.85847,0.293947 2.61673,0.810088 0.736639,0.501452 1.3282,1.21875 1.67805,2.08502l0.00118111 -0.000442914 3.63056 8.46288 0.00346949 0.00797243 -33.6839 0z" />
                <Path Fill="{StaticResource BodyGradient}" Data="M108.153 43.8407l-0.0177904 9.81969c0.785875,0.192373 1.50296,0.514888 2.10509,0.981201 1.08706,0.841681 1.75062,2.06176 1.75298,3.71021l-0.000664368 39.2644 0.00752957 0c0,1.58298 -0.652563,3.01883 -1.70758,4.06093 -1.045,1.03266 -2.48541,1.67126 -4.072,1.67126l-5.88529 0c-0.0760337,0.00967031 -0.159523,0.017126 -0.266782,0.017126l-76.1944 0c-2.15884,0 -4.12043,-0.871213 -5.54403,-2.27754 -1.43312,-1.4157 -2.32116,-3.36711 -2.32116,-5.51553l0.00752957 0 -0.0145423 -59.5726 33.6839 0 0.053814 0.125493 50.7405 0.0420768 0 -0.00745568c2.16629,0 4.07872,0.839394 5.45766,2.21856 1.38698,1.38706 2.22269,3.30945 2.22269,5.46209l-0.00752957 0z" />
                <Path Fill="#b28c53" Data="M108 53.6604l-74.8763 0c-0.499091,0 -0.926356,0.196998 -1.22768,0.512895 -0.339715,0.356103 -0.542126,0.865894 -0.542126,1.43438l0 47.7579 -3.84043 0 0 -47.7579c0,-1.56880 0.600001,-3.01883 1.60733,-4.07466 1.00667,-1.05509 2.4017,-1.71304 4.00291,-1.71304l74.8763 0 0 3.84043z" />

                <Ellipse Canvas.Left="80" Canvas.Top="80" Width="36" Height="36"
                         Opacity="0.95" Stroke="#b28c53" StrokeThickness="1.5"
                         Fill="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
                         Visibility="{Binding Visibility, ElementName=HintIcon}" />

                <Path x:Name="HintIcon" Canvas.Left="88" Canvas.Top="88" Width="20" Height="20" Stretch="Uniform"
                      Data="{Binding Header, Converter={x:Static converters:FolderToGeometryConverter.Instance}}"
                      Fill="{Binding Header, Converter={x:Static converters:FolderToGeometryConverter.Instance}}">
                    <Path.Style>
                        <Style TargetType="Path">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Data, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Path.Style>
                </Path>
            </Canvas>
        </Viewbox>

        <Grid Grid.Row="2" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="2" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" Text="{Binding Header, FallbackValue=Folder Name}"
                       FontSize="13" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontWeight="DemiBold"
                       TextAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                       Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"/>

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition>
                        <ColumnDefinition.Width>
                            <MultiBinding Converter="{x:Static converters:RatioToGridLengthConverter.Instance}">
                                <Binding Path="Folders.Count" />
                                <Binding Path="AssetsList.Assets.Count" />
                            </MultiBinding>
                        </ColumnDefinition.Width>
                    </ColumnDefinition>
                    <ColumnDefinition Width="1" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Border Grid.Column="0" Background="#E8C480" />
                <Border Grid.Column="2" Background="#A8D8EA" />
            </Grid>
        </Grid>
    </Grid>
</UserControl>
