Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="ListBoxDragDrop.Views.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:gong="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
- xmlns:VM ="clr-namespace:ListBoxDragDrop.ViewModels"
- xmlns:V ="clr-namespace:ListBoxDragDrop.Views"
- xmlns:md="https://github.com/fantasticfiasco/mvvm-dialogs"
- md:DialogServiceViews.IsRegistered="True"
- Title="Coin gałęzie" Height="350" Width="525">
- <!--<Window.DataContext>
- <VM:MainWindowViewModel></VM:MainWindowViewModel>
- </Window.DataContext>-->
- <Window.Resources>
- <DataTemplate x:Key="DragAdorner">
- <Border
- BorderBrush="#FF007ACC"
- BorderThickness="1"
- CornerRadius="2">
- <StackPanel Orientation="Horizontal" Background="#FF007ACC">
- <TextBlock Text="{Binding Name}"
- Margin="1.7"
- Foreground="White"
- VerticalAlignment="Center" />
- </StackPanel>
- </Border>
- </DataTemplate>
- <V:TagImageConverter x:Key="TagImageConverter" />
- <V:MultiValueConverter x:Key="MultiValueConverter" />
- </Window.Resources>
- <Window.InputBindings>
- <KeyBinding Modifiers="Control"
- Key="F"
- Command="{Binding FindCmd}" />
- <KeyBinding Key="F3"
- Command="{Binding FindNextCmd}" />
- <KeyBinding Modifiers="Ctrl+Shift"
- Key="F"
- Command="{Binding FindBackCmd}" />
- <KeyBinding Key="F3" Modifiers="Shift"
- Command="{Binding FindBackNextCmd}" />
- </Window.InputBindings>
- <Grid x:Name="grid" >
- <Grid.Style>
- <Style>
- <Style.Triggers>
- <DataTrigger Binding="{Binding TreeFocused}" Value="True">
- <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=treeView}"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Grid.Style>
- <Grid.RowDefinitions>
- <RowDefinition Height="24"/>
- <RowDefinition Height="24"/>
- <RowDefinition Height="30"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="30"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <TreeView Grid.Row="3" x:Name="treeView" ItemsSource="{Binding TreeCollection}"
- gong:DragDrop.IsDragSource="True"
- gong:DragDrop.IsDropTarget="True"
- gong:DragDrop.DropHandler="{Binding}"
- BorderThickness="0 1 1 0"
- gong:DragDrop.DragAdornerTemplate="{StaticResource DragAdorner}">
- <TreeView.ItemContainerStyle>
- <Style TargetType="TreeViewItem">
- <Setter Property="IsSelected" Value="{Binding Path=IsSelected}"/>
- <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded}"/>
- </Style>
- </TreeView.ItemContainerStyle>
- <TreeView.ItemTemplate>
- <HierarchicalDataTemplate ItemsSource="{Binding Children}">
- <StackPanel Orientation="Horizontal" >
- <Image Name="img" Width="16" Height="16" Stretch="Fill"
- Source="{Binding ImageIndex, Converter={StaticResource TagImageConverter}}" />
- <TextBlock Text="{Binding Name}" />
- </StackPanel>
- </HierarchicalDataTemplate>
- </TreeView.ItemTemplate>
- </TreeView>
- <ListView Grid.Row="3" x:Name="listView" ItemsSource="{Binding ListCollection}"
- Grid.Column="1">
- <ListView.ItemTemplate>
- <HierarchicalDataTemplate ItemsSource="{Binding Children}">
- <StackPanel Orientation="Horizontal" >
- <Image Name="img" Width="16" Height="16" Stretch="Fill"
- Source="{Binding ImageIndex, Converter={StaticResource TagImageConverter}}" />
- <TextBlock Text="{Binding Name}" />
- </StackPanel>
- </HierarchicalDataTemplate>
- </ListView.ItemTemplate>
- </ListView>
- <TextBox x:Name="textTreeCount" Grid.Row="2" HorizontalAlignment="Right" Height="23" Margin="112,3,20,0" TextWrapping="Wrap" Text="{Binding TreeCounter}" VerticalAlignment="Top" Width="40"/>
- <TextBox x:Name="textListCount" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" Height="23" Margin="108,3,20,0" TextWrapping="Wrap" Text="{Binding ListCounter}" VerticalAlignment="Top" Width="40"/>
- <Button Command="{Binding CountTreeCmd}" Grid.Row="2" Content="Count" HorizontalAlignment="Right" Margin="32,5,60,0" VerticalAlignment="Top" Width="45"/>
- <Button Command="{Binding CountListCmd}" Grid.Row="2" Content="Count" Grid.Column="1" HorizontalAlignment="Right" Margin="28,5,60,0" VerticalAlignment="Top" Width="45"/>
- <Button Command="{Binding InsertCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" Content="Insert" HorizontalAlignment="Left" Margin="10,5,0,0" Grid.Row="4" VerticalAlignment="Top" Width="45"/>
- <Button Command="{Binding DeleteCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" Content="Delete" HorizontalAlignment="Left" Margin="69,5,0,0" Grid.Row="4" VerticalAlignment="Top" Width="45"/>
- <Button Command="{Binding RenameCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" Content="Rename" HorizontalAlignment="Left" Margin="128,5,0,0" Grid.Row="4" VerticalAlignment="Top" Width="52"/>
- <Button Command="{Binding MoveToTreeCmd}" Content="<<" Grid.Column="1" HorizontalAlignment="Left" Margin="15,5,0,0" Grid.Row="4" VerticalAlignment="Top" Width="75">
- <Button.CommandParameter>
- <MultiBinding Converter="{StaticResource MultiValueConverter}">
- <Binding Path="SelectedItem" ElementName="listView"/>
- <Binding Path="SelectedItem" ElementName="treeView"/>
- </MultiBinding>
- </Button.CommandParameter>
- </Button>
- <ToolBarTray Grid.Column="0" Grid.Row="1">
- <ToolBar>
- <Button Command="Undo">
- <Image Source="/undo.png" Width="16" Height="16">
- <Image.Style>
- <Style TargetType="Image">
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Opacity" Value="0.5" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
- </Button>
- <Button Command="Redo">
- <Image Source="/redo.png" Width="16" Height="16">
- <Image.Style>
- <Style TargetType="Image">
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Opacity" Value="0.5" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
- </Button>
- <Button Command="Open" Content="Open" />
- <Button Command="Save">
- <Image Source="/save.png" Width="16" Height="16">
- <Image.Style>
- <Style TargetType="Image">
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Opacity" Value="0.5" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
- </Button>
- </ToolBar>
- <ToolBar>
- <Button Command="Cut" Content="Cut" />
- <Button Command="Copy" Content="Copy" />
- <Button Command="Paste" Content="Paste" />
- </ToolBar>
- </ToolBarTray>
- <Menu DockPanel.Dock="Top" Grid.Column="0">
- <MenuItem Header="_Tree">
- <MenuItem Command="Undo" Header="Undo" />
- <MenuItem Command="Redo" Header="Redo" />
- <MenuItem Header="Find" InputGestureText="Ctrl F" Command="{Binding FindCmd}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
- <MenuItem Header="Find next" InputGestureText="F3" Command="{Binding FindNextCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" />
- <MenuItem Header="Find back" InputGestureText="Ctrl+Shift F" Command="{Binding FindBackCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}"/>
- <MenuItem Header="Find back next" InputGestureText="Shift F3" Command="{Binding FindBackNextCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" />
- <MenuItem Command="Save" Header="Save" />
- <MenuItem Header="_Open" />
- <Separator />
- <MenuItem Header="_Exit" />
- </MenuItem>
- </Menu>
- <CheckBox IsChecked="{Binding DropBeforeCheckBox}" Content="Drop before" HorizontalAlignment="Left" Margin="14,7,0,0" Grid.Row="2" VerticalAlignment="Top" RenderTransformOrigin="0,0" Width="88">
- </CheckBox>
- </Grid>
- </Window>
Advertisement
Add Comment
Please, Sign In to add comment