<UserControl x:Class="HavenSoft.HexManiac.WPF.Controls.DexReorderView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:hshmwpfc="clr-namespace:HavenSoft.HexManiac.WPF.Controls">
   <DockPanel>
      <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top">
         <TextBlock Text="Filter Name/Type:" VerticalAlignment="Center"/>
         <TextBox Width="100" Margin="5" Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}"/>
      </StackPanel>
      <ScrollViewer Background="{DynamicResource Background}" PreviewMouseWheel="ElementScroll">
         <ItemsControl Name="Container" ItemsSource="{Binding Elements}" MouseDown="StartElementMove" MouseMove="ElementMove" MouseUp="EndElementMove">
            <ItemsControl.ItemsPanel>
               <ItemsPanelTemplate>
                  <WrapPanel/>
               </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
               <DataTemplate>
                  <Border BorderThickness="2" Margin="-1" Name="PixelImage" ToolTip="{Binding Name}">
                     <Border.Style>
                        <Style TargetType="Border">
                           <Style.Triggers>
                              <DataTrigger Binding="{Binding Selected}" Value="True">
                                 <Setter Property="BorderBrush" Value="{DynamicResource Accent}"/>
                              </DataTrigger>
                              <DataTrigger Binding="{Binding IsFilteredOut}" Value="True">
                                 <DataTrigger.EnterActions>
                                    <BeginStoryboard>
                                       <Storyboard>
                                          <DoubleAnimation Storyboard.TargetProperty="Opacity" To=".3" Duration="0:0:.2"/>
                                       </Storyboard>
                                    </BeginStoryboard>
                                 </DataTrigger.EnterActions>
                                 <DataTrigger.ExitActions>
                                    <BeginStoryboard>
                                       <Storyboard>
                                          <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.2"/>
                                       </Storyboard>
                                    </BeginStoryboard>
                                 </DataTrigger.ExitActions>
                              </DataTrigger>
                           </Style.Triggers>
                        </Style>
                     </Border.Style>
                     <hshmwpfc:PixelImage/>
                  </Border>
               </DataTemplate>
            </ItemsControl.ItemTemplate>
         </ItemsControl>
      </ScrollViewer>
   </DockPanel>
</UserControl>
