<UserControl x:Class="Filtration.Views.ToolPanes.BlockGroupBrowserView"
             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"
             xmlns:viewModels="clr-namespace:Filtration.ViewModels"
             xmlns:converters="clr-namespace:Filtration.Converters"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:behaviors="clr-namespace:Filtration.Views.Behaviors"
             xmlns:toolPanes="clr-namespace:Filtration.ViewModels.ToolPanes"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance Type=toolPanes:BlockGroupBrowserViewModel}"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <converters:BlockGroupAdvancedColorConverter x:Key="BlockGroupAdvancedColorConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ToolBar Grid.Row="0">
            <Button Height="20" Command="{Binding FilterToSelectedBlockGroupCommand}" Content="{StaticResource FilterIcon}" ToolTip="Filter to Selected Block Group" />
            <Button Height="20" Content="{StaticResource ExpandIcon}" ToolTip="Expand All (Not Implemented)" Name="ExpandAllButton" />
            <Button Height="20" Content="{StaticResource CollapseIcon}" ToolTip="Collapse All (Not Implemented)" Name="CollapseAllButton" />
        </ToolBar>
        <TreeView Grid.Row="1" ItemsSource="{Binding BlockGroupViewModels}" Name="TreeView">
            <i:Interaction.Behaviors>
                <behaviors:BindableSelectedItemBehavior SelectedItem="{Binding SelectedBlockGroupViewModel, Mode=OneWayToSource}" />
            </i:Interaction.Behaviors>
            <TreeView.Resources>
                <HierarchicalDataTemplate DataType="{x:Type viewModels:ItemFilterBlockGroupViewModel}" ItemsSource="{Binding ChildGroups}">
                    <WrapPanel>
                            <CheckBox IsThreeState="True" IsChecked="{Binding IsChecked}" Click="BlockGroupCheckBox_Clicked" />
                            <TextBlock Text="{Binding GroupName}" VerticalAlignment="Center" Foreground="{Binding Advanced, Converter={StaticResource BlockGroupAdvancedColorConverter}}" />
                    </WrapPanel>
                </HierarchicalDataTemplate>
            </TreeView.Resources>
        </TreeView>
    </Grid>
</UserControl>
