<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="Select From Dict"
    Height="550" Width="400"
    MinWidth="400"
    MinHeight="550" MaxHeight="550"
    WindowStartupLocation="CenterScreen"
    HorizontalAlignment="Center"
    ShowInTaskbar="True"
    WindowStyle="None"
    AllowsTransparency="True"
    Background="#080326">

    <!--MAIN-->
    <Grid>
        <Grid.Background>
            <LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
                <GradientStop Color= "#33FC467B" Offset="0" />
                <GradientStop Color="#333F5EFB" Offset="1" />
            </LinearGradientBrush>
        </Grid.Background>


        <Grid.RowDefinitions>

            <RowDefinition Height="25"/>
            <RowDefinition Height="45"/>
            <RowDefinition/>
            <RowDefinition Height="25"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <!--HEADER START-->
        <Grid   MouseDown="header_drag"
                Background="{StaticResource header_background}"
                Grid.ColumnSpan="2">
            <!--HEADER GRID-->
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="75"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="60"/>
            </Grid.ColumnDefinitions>

            <!--LOGO-->
            <DockPanel  Grid.Column="0"
                        Grid.ColumnSpan="2"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left">


                <TextBlock Margin="5,0,0,0">
                    <Hyperlink
                        RequestNavigate="Hyperlink_RequestNavigate"
                        NavigateUri="https://www.linkedin.com/company/80151029"
                        FontSize="14px"
                        FontWeight="Heavy"
                        Foreground="{StaticResource text_white}">
                        EF-Tools
                    </Hyperlink>
                </TextBlock>
            </DockPanel>

            <!--__TITLE__-->
            <TextBlock x:Name="main_title"
                Text="__title__"
                Grid.Column="1"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"
                Foreground="{StaticResource text_white}"
                />

            <!--CLOSE-->
            <Button
                Content="Close"
                Grid.Column="2"
                Width="60" Height="20"
                FontSize="10"
                Click="button_close"
                VerticalAlignment="Center"
                HorizontalAlignment="Right"
                    />
        </Grid>
        <!--HEADER END-->



        <!--FILTER START-->
        <DockPanel Grid.Row="1">
            <Label  Content="🔍"
                    VerticalAlignment="Top" Height="26"
                    Foreground="{StaticResource text_magenta}"
                    Margin="5,5,5,5"/>

            <TextBox x:Name="textbox_filter"
                    Text=""
                     Height="22" VerticalAlignment="Top"
                     Foreground="{StaticResource text_magenta}" Background="{StaticResource header_background}"
                     Margin="0,8,10,5" FontSize="14"
                     BorderBrush="{StaticResource border_magenta}"
                     TextChanged="text_filter_updated">

                <TextBox.Style>
                    <Style TargetType="TextBox">
                        <Style.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" Value="5"/>
                            </Style>
                        </Style.Resources>
                    </Style>
                </TextBox.Style>
            </TextBox>
        </DockPanel>
        <!--FILTER END-->

        <!--LISTBOX START-->
        <StackPanel Grid.Row="2"
                    VerticalAlignment="Top"
                    Margin="10,5,10,5">

            <Separator Background="{StaticResource border_magenta}"/>

            <Label x:Name="text_label"  Content="Select Elements:"
                           Foreground="{StaticResource text_magenta}"/>

            <ListBox x:Name="main_ListBox"
                         Height="350" Grid.Row="0"
                         Background="{StaticResource header_background}"
                         SelectionMode="Single"
                         ScrollViewer.VerticalScrollBarVisibility="Visible"
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                         BorderBrush="{StaticResource border_magenta}"
                         >

                <ListBox.Resources>
                    <Style TargetType="ScrollBar">
                        <Setter Property="Background" Value="{StaticResource border_magenta}"/>
                        <Setter Property="Foreground" Value="{StaticResource border_magenta}"/>
                        <Setter Property="BorderBrush" Value="{StaticResource header_background}"/>
                        <Setter Property="Opacity" Value="0.9"/>
                        <Setter Property="Margin" Value="3"/>

                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ScrollBar}">
                                    <Grid x:Name="Bg"
                                              SnapsToDevicePixels="true">
                                        <Border BorderBrush     = "{TemplateBinding BorderBrush}"
                                                    BorderThickness = "{TemplateBinding BorderThickness}"
                                                    Background      = "{TemplateBinding Background}"

                                                    Grid.Row        = "1"
                                                    CornerRadius="10"/>

                                        <Track x:Name="PART_Track"
                                                   IsDirectionReversed="true"
                                                   IsEnabled="{TemplateBinding IsMouseOver}"
                                                   Grid.Row="1">
                                            <Track.Thumb>
                                                <Thumb Style="{StaticResource ScrollBarThumbVertical}"
                                                           Margin="2"/>
                                            </Track.Thumb>
                                        </Track>

                                    </Grid>

                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <Style TargetType="ListBox">
                        <Style.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" Value="10"/>
                            </Style>
                        </Style.Resources>
                    </Style>
                </ListBox.Resources>

                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox  Background="#EE82EE" Foreground="{StaticResource text_white}" IsChecked="{Binding IsChecked}"  Checked="UIe_ItemChecked" >
                            <TextBlock Text="{Binding Name}"/>
                        </CheckBox>
                    </DataTemplate>
                </ListBox.ItemTemplate>


            </ListBox>

            <!--BUTTONS START-->
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" x:Name="UI_Buttons_all_none">
                <!--BUTTON_1-->
                <Button Content="Select All"
                        Click="button_select_all"
                        Height="20"
                        Width="100"
                        Margin="5"
                        />
                <!--BUTTON_2-->
                <Button Content="Select None"
                        Click="button_select_none"
                        Height="20"
                        Width="100"
                        Margin="5"
                        />
            </StackPanel>
            <!--BUTTONS END-->

            <!--BUTTON_2-->
            <Button x:Name="button_main"
                Content="Select"
                        Click="button_select"
                        Height="30"
                        Width="210"
                        Margin="5"
                        />

        </StackPanel>
        <!--LISTBOX END-->

        <!--FOOTER START-->
        <Grid Grid.Row="3" Background="{StaticResource header_background}">
            <!--FOOTER GRID-->
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <!--IMAGE-->
            <TextBlock>
                <Hyperlink  NavigateUri="https://www.learnrevitapi.com" RequestNavigate="Hyperlink_RequestNavigate">
                               <Image  Height="20"   Margin="1"  HorizontalAlignment="Left"   VerticalAlignment="Top"
                                   Source="https://www.learnrevitapi.com/static/img_new/logo/logo_learnrevitapi.png" />
                </Hyperlink>
            </TextBlock>



            <!--VERSION-->
            <TextBlock x:Name="footer_version"
              Text="Version: 1.0"
              Grid.Column="1"
              VerticalAlignment="Center"
              HorizontalAlignment="Center"
              Foreground="{StaticResource text_gray}"
    />

            <!--Ko-Fi-->
            <TextBlock  Grid.Column="2"
              VerticalAlignment="Center"
              HorizontalAlignment="Right"
              Margin="0,0,10,0">
              <Hyperlink
                  RequestNavigate="Hyperlink_RequestNavigate"
                  NavigateUri="https://www.ko-fi.com/ErikFrits"
                  FontWeight="Medium"
                  Foreground="{StaticResource button_bg_hover}">
                  Support EF-Tools
              </Hyperlink>
            </TextBlock>
        </Grid>
        <!--FOOTER END-->
    </Grid>
</Window>