Borneq

MojeKategorie_xaml

Mar 17th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 10.30 KB | None | 0 0
  1. <Window x:Class="ListBoxDragDrop.Views.MainWindow"
  2.        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.        xmlns:gong="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
  5.        xmlns:VM ="clr-namespace:ListBoxDragDrop.ViewModels"
  6.        xmlns:V ="clr-namespace:ListBoxDragDrop.Views"
  7.        xmlns:md="https://github.com/fantasticfiasco/mvvm-dialogs"
  8.        md:DialogServiceViews.IsRegistered="True"
  9.        Title="Coin gałęzie" Height="350" Width="525">
  10.  
  11.     <!--<Window.DataContext>
  12.         <VM:MainWindowViewModel></VM:MainWindowViewModel>
  13.    </Window.DataContext>-->
  14.  
  15.     <Window.Resources>
  16.         <DataTemplate x:Key="DragAdorner">
  17.             <Border
  18.              BorderBrush="#FF007ACC"
  19.              BorderThickness="1"
  20.              CornerRadius="2">
  21.                 <StackPanel Orientation="Horizontal"   Background="#FF007ACC">
  22.                     <TextBlock Text="{Binding Name}"
  23.                    Margin="1.7"
  24.                               Foreground="White"
  25.                     VerticalAlignment="Center" />
  26.                 </StackPanel>
  27.             </Border>
  28.         </DataTemplate>
  29.         <V:TagImageConverter x:Key="TagImageConverter" />
  30.         <V:MultiValueConverter x:Key="MultiValueConverter" />
  31.     </Window.Resources>
  32.  
  33.     <Window.InputBindings>
  34.         <KeyBinding Modifiers="Control"
  35.                    Key="F"
  36.                    Command="{Binding FindCmd}" />
  37.         <KeyBinding Key="F3"
  38.                    Command="{Binding FindNextCmd}" />
  39.         <KeyBinding Modifiers="Ctrl+Shift"
  40.                    Key="F"
  41.                    Command="{Binding FindBackCmd}" />
  42.         <KeyBinding Key="F3" Modifiers="Shift"
  43.                    Command="{Binding FindBackNextCmd}" />
  44.     </Window.InputBindings>
  45.  
  46.     <Grid x:Name="grid" >
  47.         <Grid.Style>
  48.             <Style>
  49.                 <Style.Triggers>
  50.                     <DataTrigger Binding="{Binding TreeFocused}" Value="True">
  51.                         <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=treeView}"/>
  52.                     </DataTrigger>
  53.                 </Style.Triggers>
  54.             </Style>
  55.         </Grid.Style>
  56.         <Grid.RowDefinitions>
  57.             <RowDefinition Height="24"/>
  58.             <RowDefinition Height="24"/>
  59.             <RowDefinition Height="30"/>
  60.             <RowDefinition Height="*"/>
  61.             <RowDefinition Height="30"/>
  62.         </Grid.RowDefinitions>
  63.  
  64.         <Grid.ColumnDefinitions>
  65.             <ColumnDefinition Width="*"/>
  66.             <ColumnDefinition Width="*"/>
  67.         </Grid.ColumnDefinitions>
  68.  
  69.         <TreeView Grid.Row="3" x:Name="treeView" ItemsSource="{Binding TreeCollection}"
  70.                  gong:DragDrop.IsDragSource="True"
  71.                  gong:DragDrop.IsDropTarget="True"
  72.                  gong:DragDrop.DropHandler="{Binding}"
  73.                  BorderThickness="0 1 1 0"
  74.                  gong:DragDrop.DragAdornerTemplate="{StaticResource DragAdorner}">
  75.             <TreeView.ItemContainerStyle>
  76.                 <Style TargetType="TreeViewItem">
  77.                     <Setter Property="IsSelected" Value="{Binding Path=IsSelected}"/>
  78.                     <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded}"/>
  79.                 </Style>
  80.             </TreeView.ItemContainerStyle>
  81.             <TreeView.ItemTemplate>
  82.                 <HierarchicalDataTemplate ItemsSource="{Binding Children}">
  83.                     <StackPanel Orientation="Horizontal" >
  84.                         <Image Name="img" Width="16" Height="16" Stretch="Fill"                                
  85.                              Source="{Binding ImageIndex, Converter={StaticResource TagImageConverter}}" />
  86.                         <TextBlock Text="{Binding Name}" />
  87.                     </StackPanel>
  88.                 </HierarchicalDataTemplate>
  89.             </TreeView.ItemTemplate>
  90.         </TreeView>
  91.         <ListView Grid.Row="3" x:Name="listView"  ItemsSource="{Binding ListCollection}"
  92.            Grid.Column="1">
  93.             <ListView.ItemTemplate>
  94.                 <HierarchicalDataTemplate ItemsSource="{Binding Children}">
  95.                     <StackPanel Orientation="Horizontal" >
  96.                         <Image Name="img" Width="16" Height="16" Stretch="Fill"                                
  97.                              Source="{Binding ImageIndex, Converter={StaticResource TagImageConverter}}" />
  98.                         <TextBlock Text="{Binding Name}" />
  99.                     </StackPanel>
  100.                 </HierarchicalDataTemplate>
  101.             </ListView.ItemTemplate>
  102.         </ListView>
  103.         <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"/>
  104.         <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"/>
  105.         <Button Command="{Binding CountTreeCmd}" Grid.Row="2" Content="Count" HorizontalAlignment="Right" Margin="32,5,60,0" VerticalAlignment="Top" Width="45"/>
  106.         <Button Command="{Binding CountListCmd}" Grid.Row="2" Content="Count" Grid.Column="1" HorizontalAlignment="Right" Margin="28,5,60,0" VerticalAlignment="Top" Width="45"/>
  107.         <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"/>
  108.         <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"/>
  109.         <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"/>
  110.         <Button Command="{Binding MoveToTreeCmd}" Content="&lt;&lt;" Grid.Column="1" HorizontalAlignment="Left" Margin="15,5,0,0" Grid.Row="4" VerticalAlignment="Top" Width="75">
  111.             <Button.CommandParameter>
  112.                 <MultiBinding Converter="{StaticResource MultiValueConverter}">
  113.                     <Binding Path="SelectedItem" ElementName="listView"/>
  114.                     <Binding Path="SelectedItem" ElementName="treeView"/>
  115.                 </MultiBinding>
  116.             </Button.CommandParameter>
  117.         </Button>
  118.         <ToolBarTray Grid.Column="0" Grid.Row="1">
  119.             <ToolBar>
  120.                 <Button Command="Undo">
  121.                     <Image Source="/undo.png" Width="16" Height="16">
  122.                         <Image.Style>
  123.                             <Style TargetType="Image">
  124.                                 <Style.Triggers>
  125.                                     <Trigger Property="IsEnabled" Value="False">
  126.                                         <Setter Property="Opacity" Value="0.5" />
  127.                                     </Trigger>
  128.                                 </Style.Triggers>
  129.                             </Style>
  130.                         </Image.Style>
  131.                     </Image>
  132.                 </Button>
  133.                 <Button Command="Redo">
  134.                     <Image Source="/redo.png" Width="16" Height="16">
  135.                         <Image.Style>
  136.                             <Style TargetType="Image">
  137.                                 <Style.Triggers>
  138.                                     <Trigger Property="IsEnabled" Value="False">
  139.                                         <Setter Property="Opacity" Value="0.5" />
  140.                                     </Trigger>
  141.                                 </Style.Triggers>
  142.                             </Style>
  143.                         </Image.Style>
  144.                     </Image>
  145.                 </Button>
  146.                 <Button Command="Open" Content="Open" />
  147.                 <Button Command="Save">
  148.                     <Image Source="/save.png" Width="16" Height="16">
  149.                         <Image.Style>
  150.                             <Style TargetType="Image">
  151.                                 <Style.Triggers>
  152.                                     <Trigger Property="IsEnabled" Value="False">
  153.                                         <Setter Property="Opacity" Value="0.5" />
  154.                                     </Trigger>
  155.                                 </Style.Triggers>
  156.                             </Style>
  157.                         </Image.Style>
  158.                     </Image>
  159.                 </Button>
  160.             </ToolBar>
  161.             <ToolBar>
  162.                 <Button Command="Cut" Content="Cut" />
  163.                 <Button Command="Copy" Content="Copy" />
  164.                 <Button Command="Paste" Content="Paste" />
  165.             </ToolBar>
  166.         </ToolBarTray>
  167.         <Menu DockPanel.Dock="Top" Grid.Column="0">
  168.             <MenuItem Header="_Tree">
  169.                 <MenuItem Command="Undo" Header="Undo" />
  170.                 <MenuItem Command="Redo" Header="Redo" />
  171.                 <MenuItem Header="Find" InputGestureText="Ctrl F" Command="{Binding FindCmd}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
  172.                 <MenuItem Header="Find next" InputGestureText="F3" Command="{Binding FindNextCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" />
  173.                 <MenuItem Header="Find back" InputGestureText="Ctrl+Shift F" Command="{Binding FindBackCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}"/>
  174.                 <MenuItem Header="Find back next" InputGestureText="Shift F3" Command="{Binding FindBackNextCmd}" CommandParameter="{Binding SelectedItem, ElementName=treeView}" />
  175.                 <MenuItem Command="Save" Header="Save" />
  176.                 <MenuItem Header="_Open" />
  177.                 <Separator />
  178.                 <MenuItem Header="_Exit" />
  179.             </MenuItem>
  180.         </Menu>
  181.         <CheckBox IsChecked="{Binding DropBeforeCheckBox}" Content="Drop before" HorizontalAlignment="Left" Margin="14,7,0,0" Grid.Row="2" VerticalAlignment="Top" RenderTransformOrigin="0,0" Width="88">
  182.         </CheckBox>
  183.  
  184.  
  185.     </Grid>
  186. </Window>
Advertisement
Add Comment
Please, Sign In to add comment