<!--xmlns:vm-navigator="clr-namespace:qmonlib.ui.ViewModels.Navigator"
             x:DataType="vm-navigator:NavSearchViewModel"-->
<UserControl xmlns="https://github.com/avaloniaui"
             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"
             xmlns:vm="clr-namespace:qmonlib.ui.ViewModels"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="qmonlib.ui.Views.Navigator.NavFilter"
             x:CompileBindings="False">

    <!--<Design.DataContext>
        --><!-- This only sets the DataContext for the previewer in an IDE,
         to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --><!--
        <vm:MainViewModel />
    </Design.DataContext>-->

    <Grid Height="32" VerticalAlignment="Top" DataContext="{Binding NavSearch}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="32" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!-- textbox: filter input -->
        <TextBox Name="tbSearch"
                 Text="{Binding SearchText}"
                 Watermark="Type pattern filter"
                 FlowDirection="LeftToRight"
                 Grid.Column="0"
                 Grid.Row="1">
            <ToolTip.Tip>
                Put pattern like (use * for any character) string to filter requested values from list
            </ToolTip.Tip>
        </TextBox>
        
        <!-- button: clear filter -->
        <Button
            Width="32" Height="32"
            VerticalAlignment="Top"
            Grid.Column="1"
            Grid.Row="1">
            <Button.Content>
                X
            </Button.Content>
            <ToolTip.Tip>
                Clears filter pattern text box
            </ToolTip.Tip>
        </Button>
  
        <!-- combobox: identifier selection -->
        <Expander Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Top">
            <Expander.Header>
                <TextBlock>
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}Select source identifiers ({1}/{0})">
                            <Binding Path="DataInstancesCount" />
                            <Binding Path="DataInstancesSelectedCount" />
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Expander.Header>
            <ListBox Name="lbIdentifiers" ItemsSource="{Binding DataInstances}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Panel>
                            <CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Name}"
                                      />
                        </Panel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <ToolTip.Tip>
                Select allowed source identifier instances to show in source channel list
            </ToolTip.Tip>
        </Expander>
    </Grid>
</UserControl>