Equbuxu преди 3 години
родител
ревизия
e20abee5ae

+ 1 - 1
src/PixiEditor/Views/UserControls/Layers/LayerFolderControl.xaml → src/PixiEditor/Views/UserControls/Layers/FolderControl.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="PixiEditor.Views.UserControls.Layers.LayerFolderControl"
+<UserControl x:Class="PixiEditor.Views.UserControls.Layers.FolderControl"
              x:ClassModifier="internal"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

+ 14 - 60
src/PixiEditor/Views/UserControls/Layers/LayerFolderControl.xaml.cs → src/PixiEditor/Views/UserControls/Layers/FolderControl.xaml.cs

@@ -1,70 +1,24 @@
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
-using System.Windows.Media.Imaging;
-using PixiEditor.ViewModels.SubViewModels.Main;
+using PixiEditor.ViewModels.SubViewModels.Document;
 
 namespace PixiEditor.Views.UserControls.Layers;
 
-internal partial class LayerFolderControl : UserControl
+internal partial class FolderControl : UserControl
 {
-    public static readonly DependencyProperty GroupGuidProperty =
-        DependencyProperty.Register(nameof(FolderGuid), typeof(Guid), typeof(LayerFolderControl), new PropertyMetadata(Guid.NewGuid()));
-    public Guid FolderGuid
-    {
-        get => (Guid)GetValue(GroupGuidProperty);
-        set => SetValue(GroupGuidProperty, value);
-    }
-
-    public static readonly DependencyProperty LayersViewModelProperty =
-        DependencyProperty.Register(nameof(LayersViewModel), typeof(LayersViewModel), typeof(LayerFolderControl), new PropertyMetadata(default(LayersViewModel)));
-    public LayersViewModel LayersViewModel
-    {
-        get { return (LayersViewModel)GetValue(LayersViewModelProperty); }
-        set { SetValue(LayersViewModelProperty, value); }
-    }
-
-    public bool IsVisibleUndoTriggerable
-    {
-        get { return (bool)GetValue(IsVisibleUndoTriggerableProperty); }
-        set { SetValue(IsVisibleUndoTriggerableProperty, value); }
-    }
-
-    public static readonly DependencyProperty IsVisibleUndoTriggerableProperty =
-        DependencyProperty.Register(nameof(IsVisibleUndoTriggerable), typeof(bool), typeof(LayerFolderControl), new PropertyMetadata(true));
-
-    public float GroupOpacity
-    {
-        get { return (float)GetValue(GroupOpacityProperty); }
-        set { SetValue(GroupOpacityProperty, value); }
-    }
-
-    public static readonly DependencyProperty GroupOpacityProperty =
-        DependencyProperty.Register(nameof(GroupOpacity), typeof(float), typeof(LayerFolderControl), new PropertyMetadata(1f));
-
-
-    public static string LayerGroupControlDataName = typeof(LayerFolderControl).FullName;
-    public static string LayerContainerDataName = typeof(LayerStructureItemContainer).FullName;
+    public static string FolderControlDataName = typeof(FolderControl).FullName;
 
-    public string GroupName
-    {
-        get { return (string)GetValue(GroupNameProperty); }
-        set { SetValue(GroupNameProperty, value); }
-    }
-
-    public static readonly DependencyProperty GroupNameProperty =
-        DependencyProperty.Register(nameof(GroupName), typeof(string), typeof(LayerFolderControl), new PropertyMetadata(default(string)));
+    public static readonly DependencyProperty FolderProperty =
+        DependencyProperty.Register(nameof(Folder), typeof(FolderViewModel), typeof(FolderControl), new(null));
 
-    public WriteableBitmap PreviewImage
+    public FolderViewModel Folder
     {
-        get { return (WriteableBitmap)GetValue(PreviewImageProperty); }
-        set { SetValue(PreviewImageProperty, value); }
+        get => (FolderViewModel)GetValue(FolderProperty);
+        set => SetValue(FolderProperty, value);
     }
 
-    public static readonly DependencyProperty PreviewImageProperty =
-        DependencyProperty.Register(nameof(PreviewImage), typeof(WriteableBitmap), typeof(LayerFolderControl), new PropertyMetadata(default(WriteableBitmap)));
-
-    public LayerFolderControl()
+    public FolderControl()
     {
         InitializeComponent();
     }
@@ -73,24 +27,24 @@ internal partial class LayerFolderControl : UserControl
     {
         Grid item = sender as Grid;
 
-        item.Background = LayerItem.HighlightColor;
+        item.Background = LayerControl.HighlightColor;
     }
 
     private void Grid_CenterEnter(object sender, DragEventArgs e)
     {
-        centerGrid.Background = LayerItem.HighlightColor;
+        centerGrid.Background = LayerControl.HighlightColor;
     }
 
     private void Grid_DragLeave(object sender, DragEventArgs e)
     {
         Grid grid = (Grid)sender;
 
-        LayerItem.RemoveDragEffect(grid);
+        LayerControl.RemoveDragEffect(grid);
     }
 
     private void Grid_CenterLeave(object sender, DragEventArgs e)
     {
-        LayerItem.RemoveDragEffect(centerGrid);
+        LayerControl.RemoveDragEffect(centerGrid);
     }
 
     /*
@@ -179,7 +133,7 @@ internal partial class LayerFolderControl : UserControl
     private void Grid_Drop_Center(object sender, DragEventArgs e)
     {
         //HandleDropInside(e.Data, (Grid)sender);
-        LayerItem.RemoveDragEffect(centerGrid);
+        LayerControl.RemoveDragEffect(centerGrid);
     }
 
     private void Grid_Drop_Bottom(object sender, DragEventArgs e)

+ 46 - 5
src/PixiEditor/Views/UserControls/Layers/LayerItem.xaml → src/PixiEditor/Views/UserControls/Layers/LayerControl.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="PixiEditor.Views.UserControls.Layers.LayerItem"
+<UserControl x:Class="PixiEditor.Views.UserControls.Layers.LayerControl"
              x:ClassModifier="internal"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -38,19 +38,20 @@
                 </Grid.ColumnDefinitions>
                 <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
                       IsThreeState="False" HorizontalAlignment="Center" 
-                      IsChecked="{Binding Path=IsVisibleUndoTriggerable, Mode=TwoWay}" Grid.Column="0" Height="16" />
+                      IsChecked="{Binding Path=Layer.IsVisibleBindable, ElementName=uc}" 
+                      Grid.Column="0" Height="16" />
                 <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left">
                     <Rectangle Width="{Binding Path=(helpers:TreeViewItemHelper.Indent).Value, Mode=OneWay, RelativeSource={RelativeSource AncestorType=ItemsPresenter}}" Fill="Transparent" StrokeThickness="0"/>
                     <Border Width="30" Height="30" BorderThickness="1" BorderBrush="Black" Background="{StaticResource MainColor}"
                            Margin="5, 0, 10, 0">
-                        <!--<Image Source="{Binding PreviewImage,ElementName=uc}" Stretch="Uniform" Width="20" Height="20"
-                       RenderOptions.BitmapScalingMode="NearestNeighbor"/>-->
+                        <Image Source="{Binding Layer.PreviewBitmap,ElementName=uc}" Stretch="Uniform" Width="20" Height="20"
+                       RenderOptions.BitmapScalingMode="NearestNeighbor"/>
                     </Border>
 
                     <controls:EditableTextBlock
                     IsEditing="{Binding IsRenaming, ElementName=uc, Mode=TwoWay}" FontSize="15"
                     VerticalAlignment="Center"
-                    Text="{Binding LayerName, ElementName=uc, Mode=TwoWay}" />
+                    Text="{Binding Layer.NameBindable, ElementName=uc, Mode=TwoWay}" />
                 </StackPanel>
                 <Grid Margin="0, 0, 0, -2.5" DragEnter="Grid_DragEnter" VerticalAlignment="Bottom" Height="10" Drop="Grid_Drop_Below"  DragLeave="Grid_DragLeave" Grid.Row="2" Grid.Column="0" AllowDrop="True"  Background="Transparent" Name="dropBelowGrid"/>
                 <Grid Margin="0, 0, 0, -2.5" VerticalAlignment="Bottom" Height="10" Grid.Row="2" Grid.Column="1" Background="{Binding ElementName=dropBelowGrid, Path=Background}"/>
@@ -58,5 +59,45 @@
                 <Grid Margin="0, 0, 0, -2.5" DragEnter="Grid_DragEnter" VerticalAlignment="Bottom" Height="10" Drop="Grid_Drop_Bottom" DragLeave="Grid_DragLeave" Grid.Row="2" Grid.Column="2" AllowDrop="True"  Background="Transparent"/>
             </Grid>
         </Grid>
+        <Border.ContextMenu>
+            <ContextMenu>
+                <MenuItem Header="Duplicate"
+                                         Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.DuplicateLayerCommand,
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
+                          CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <MenuItem Header="Delete"
+                                         Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.DeleteLayersCommand,
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
+                          CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <MenuItem Header="Rename"
+                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.RenameLayerCommand,
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <MenuItem Header="Move to front"
+                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToFrontCommand,
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}"
+                           CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <MenuItem Header="Move to back"
+                                    Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToBackCommand, 
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
+                           CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <Separator/>
+                <MenuItem Header="Merge selected"
+                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeSelectedCommand, 
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
+                <MenuItem Header="Merge with above"
+                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithAboveCommand, 
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+                <MenuItem Header="Merge with below"
+                                    Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithBelowCommand, 
+                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
+                </MenuItem>
+            </ContextMenu>
+        </Border.ContextMenu>
     </Border>
 </UserControl>

+ 22 - 58
src/PixiEditor/Views/UserControls/Layers/LayerItem.xaml.cs → src/PixiEditor/Views/UserControls/Layers/LayerControl.xaml.cs

@@ -3,41 +3,30 @@ using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
 using PixiEditor.Helpers;
+using PixiEditor.ViewModels.SubViewModels.Document;
 
 namespace PixiEditor.Views.UserControls.Layers;
 
-/// <summary>
-/// Interaction logic for LayerItem.xaml.
-/// </summary>
-internal partial class LayerItem : UserControl
+internal partial class LayerControl : UserControl
 {
     public static Brush HighlightColor = Brushes.Blue;
 
-    public LayerItem()
-    {
-        InitializeComponent();
-    }
+    public static readonly DependencyProperty LayerProperty =
+        DependencyProperty.Register(nameof(Layer), typeof(LayerViewModel), typeof(LayerControl), new(null));
 
-    public static readonly DependencyProperty IsRenamingProperty = DependencyProperty.Register(
-        nameof(IsRenaming), typeof(bool), typeof(LayerItem), new PropertyMetadata(default(bool)));
-
-    public bool IsRenaming
+    public LayerViewModel Layer
     {
-        get { return (bool)GetValue(IsRenamingProperty); }
-        set { SetValue(IsRenamingProperty, value); }
+        get => (LayerViewModel)GetValue(LayerProperty);
+        set => SetValue(LayerProperty, value);
     }
 
-    public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(
-        nameof(IsActive), typeof(bool), typeof(LayerItem), new PropertyMetadata(default(bool)));
-
-    public bool IsActive
+    public LayerControl()
     {
-        get { return (bool)GetValue(IsActiveProperty); }
-        set { SetValue(IsActiveProperty, value); }
+        InitializeComponent();
     }
 
     public static readonly DependencyProperty SetActiveLayerCommandProperty = DependencyProperty.Register(
-        nameof(SetActiveLayerCommand), typeof(RelayCommand), typeof(LayerItem), new PropertyMetadata(default(RelayCommand)));
+        nameof(SetActiveLayerCommand), typeof(RelayCommand), typeof(LayerControl), new PropertyMetadata(default(RelayCommand)));
 
     public RelayCommand SetActiveLayerCommand
     {
@@ -45,35 +34,8 @@ internal partial class LayerItem : UserControl
         set { SetValue(SetActiveLayerCommandProperty, value); }
     }
 
-    public static readonly DependencyProperty LayerIndexProperty = DependencyProperty.Register(
-        nameof(LayerIndex), typeof(int), typeof(LayerItem), new PropertyMetadata(default(int)));
-
-    public int LayerIndex
-    {
-        get { return (int)GetValue(LayerIndexProperty); }
-        set { SetValue(LayerIndexProperty, value); }
-    }
-
-    public static readonly DependencyProperty LayerNameProperty = DependencyProperty.Register(
-        nameof(LayerName), typeof(string), typeof(LayerItem), new PropertyMetadata(default(string)));
-
-    public string LayerName
-    {
-        get { return (string)GetValue(LayerNameProperty); }
-        set { SetValue(LayerNameProperty, value); }
-    }
-
-    public Guid LayerGuid
-    {
-        get { return (Guid)GetValue(LayerGuidProperty); }
-        set { SetValue(LayerGuidProperty, value); }
-    }
-
-    public static readonly DependencyProperty LayerGuidProperty =
-        DependencyProperty.Register(nameof(LayerGuid), typeof(Guid), typeof(LayerItem), new PropertyMetadata(default(Guid)));
-
     public static readonly DependencyProperty ControlButtonsVisibleProperty = DependencyProperty.Register(
-        nameof(ControlButtonsVisible), typeof(Visibility), typeof(LayerItem), new PropertyMetadata(System.Windows.Visibility.Hidden));
+        nameof(ControlButtonsVisible), typeof(Visibility), typeof(LayerControl), new PropertyMetadata(System.Windows.Visibility.Hidden));
 
     public string LayerColor
     {
@@ -82,7 +44,7 @@ internal partial class LayerItem : UserControl
     }
 
     public static readonly DependencyProperty LayerColorProperty =
-        DependencyProperty.Register(nameof(LayerColor), typeof(string), typeof(LayerItem), new PropertyMetadata("#00000000"));
+        DependencyProperty.Register(nameof(LayerColor), typeof(string), typeof(LayerControl), new PropertyMetadata("#00000000"));
 
     public Visibility ControlButtonsVisible
     {
@@ -97,10 +59,10 @@ internal partial class LayerItem : UserControl
     }
 
     public static readonly DependencyProperty MoveToBackCommandProperty =
-        DependencyProperty.Register(nameof(MoveToBackCommand), typeof(RelayCommand), typeof(LayerItem), new PropertyMetadata(default(RelayCommand)));
+        DependencyProperty.Register(nameof(MoveToBackCommand), typeof(RelayCommand), typeof(LayerControl), new PropertyMetadata(default(RelayCommand)));
 
     public static readonly DependencyProperty MoveToFrontCommandProperty = DependencyProperty.Register(
-        nameof(MoveToFrontCommand), typeof(RelayCommand), typeof(LayerItem), new PropertyMetadata(default(RelayCommand)));
+        nameof(MoveToFrontCommand), typeof(RelayCommand), typeof(LayerControl), new PropertyMetadata(default(RelayCommand)));
 
     public RelayCommand MoveToFrontCommand
     {
@@ -140,12 +102,13 @@ internal partial class LayerItem : UserControl
 
     private void HandleGridDrop(object sender, DragEventArgs e, bool above, bool dropInParentFolder = false)
     {
+        /*
         Grid item = sender as Grid;
         RemoveDragEffect(item);
 
-        if (e.Data.GetDataPresent(LayerFolderControl.LayerContainerDataName))
+        if (e.Data.GetDataPresent(FolderControl.LayerContainerDataName))
         {
-            var data = (LayerStructureItemContainer)e.Data.GetData(LayerFolderControl.LayerContainerDataName);
+            var data = (LayerControlContainer)e.Data.GetData(FolderControl.LayerContainerDataName);
             //Guid layer = data.Layer.GuidValue;
             //var doc = data.LayerCommandsViewModel.Owner.BitmapManager.ActiveDocument;
 
@@ -154,12 +117,12 @@ internal partial class LayerItem : UserControl
             {
                 Guid? groupGuid = doc.LayerStructure.GetGroupByLayer(layer)?.Parent?.GroupGuid;
                 doc.LayerStructure.AssignParent(layer, groupGuid);
-            }*/
+            }
         }
 
-        if (e.Data.GetDataPresent(LayerFolderControl.LayerGroupControlDataName))
+        if (e.Data.GetDataPresent(FolderControl.FolderControlDataName))
         {
-            var data = (LayerFolderControl)e.Data.GetData(LayerFolderControl.LayerGroupControlDataName);
+            var data = (FolderControl)e.Data.GetData(FolderControl.FolderControlDataName);
             //Guid folder = data.GroupGuid;
 
             //var document = data.LayersViewModel.Owner.BitmapManager.ActiveDocument;
@@ -171,8 +134,9 @@ internal partial class LayerItem : UserControl
                 return;
             }
 
-            document.MoveGroupInStructure(folder, LayerGuid, above);*/
+            document.MoveGroupInStructure(folder, LayerGuid, above);
         }
+*/
     }
 
     private void Grid_Drop_Top(object sender, DragEventArgs e)

+ 0 - 61
src/PixiEditor/Views/UserControls/Layers/LayerStructureItemContainer.xaml

@@ -1,61 +0,0 @@
-<UserControl x:Class="PixiEditor.Views.UserControls.Layers.LayerStructureItemContainer"
-             x:ClassModifier="internal"
-             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:vws="clr-namespace:PixiEditor.Views.UserControls.Layers"
-             mc:Ignorable="d"
-             d:DesignHeight="60" d:DesignWidth="250" Name="layerStructureContainer">
-    <vws:LayerItem Tag="{Binding ElementName=layerStructureContainer}"
-                               SetActiveLayerCommand="{Binding LayerCommandsViewModel.SetActiveLayerCommand, ElementName=layerStructureContainer}"
-                                       LayerName="{Binding Name, Mode=TwoWay}" 
-                                       IsActive="{Binding IsActive, Mode=TwoWay}"
-                                       IsRenaming="{Binding IsRenaming, Mode=TwoWay}"
-                                       LayerGuid="{Binding GuidValue}"
-                                       LayerColor="{Binding LayerHighlightColor}"
-                                       LayerIndex="{Binding ContainerIndex, ElementName=layerStructureContainer}"
-                                      MoveToBackCommand="{Binding LayerCommandsViewModel.MoveToBackCommand, ElementName=layerStructureContainer}"
-                                      MoveToFrontCommand="{Binding LayerCommandsViewModel.MoveToFrontCommand, ElementName=layerStructureContainer}">
-        <vws:LayerItem.ContextMenu>
-            <ContextMenu>
-                <MenuItem Header="Duplicate"
-                                         Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.DuplicateLayerCommand,
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
-                          CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <MenuItem Header="Delete"
-                                         Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.DeleteLayersCommand,
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
-                          CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <MenuItem Header="Rename"
-                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.RenameLayerCommand,
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <MenuItem Header="Move to front"
-                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToFrontCommand,
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}"
-                           CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <MenuItem Header="Move to back"
-                                    Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToBackCommand, 
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" 
-                           CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <Separator/>
-                <MenuItem Header="Merge selected"
-                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeSelectedCommand, 
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
-                <MenuItem Header="Merge with above"
-                                     Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithAboveCommand, 
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-                <MenuItem Header="Merge with below"
-                                    Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithBelowCommand, 
-                                            RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="{Binding PlacementTarget.Tag.ContainerIndex, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
-                </MenuItem>
-            </ContextMenu>
-        </vws:LayerItem.ContextMenu>
-    </vws:LayerItem>
-</UserControl>

+ 0 - 36
src/PixiEditor/Views/UserControls/Layers/LayerStructureItemContainer.xaml.cs

@@ -1,36 +0,0 @@
-using System.Windows;
-using System.Windows.Controls;
-using PixiEditor.ViewModels.SubViewModels.Main;
-
-namespace PixiEditor.Views.UserControls.Layers;
-
-/// <summary>
-/// Interaction logic for LayerStructureItemContainer.xaml.
-/// </summary>
-internal partial class LayerStructureItemContainer : UserControl
-{
-    public LayersViewModel LayerCommandsViewModel
-    {
-        get { return (LayersViewModel)GetValue(LayerCommandsViewModelProperty); }
-        set { SetValue(LayerCommandsViewModelProperty, value); }
-    }
-
-
-    public static readonly DependencyProperty LayerCommandsViewModelProperty =
-        DependencyProperty.Register(nameof(LayerCommandsViewModel), typeof(LayersViewModel), typeof(LayerStructureItemContainer), new PropertyMetadata(default(LayersViewModel)));
-
-    public int ContainerIndex
-    {
-        get { return (int)GetValue(ContainerIndexProperty); }
-        set { SetValue(ContainerIndexProperty, value); }
-    }
-
-
-    public static readonly DependencyProperty ContainerIndexProperty =
-        DependencyProperty.Register(nameof(ContainerIndex), typeof(int), typeof(LayerStructureItemContainer), new PropertyMetadata(0));
-
-    public LayerStructureItemContainer()
-    {
-        InitializeComponent();
-    }
-}

+ 4 - 6
src/PixiEditor/Views/UserControls/Layers/LayersManager.xaml

@@ -76,16 +76,14 @@
                 </TreeView.ItemsPanel>
                 <TreeView.Resources>
                     <HierarchicalDataTemplate DataType="{x:Type docVm:FolderViewModel}" ItemsSource="{Binding Children}">
-                        <layerUserControls:LayerFolderControl 
-                            GroupName="{Binding NameBindable}" 
-                            IsVisibleUndoTriggerable="{Binding IsVisibleBindable}" 
-                            GroupOpacity="{Binding OpacityBindable}"
-                            FolderGuid="{Binding GuidValue}"
+                        <layerUserControls:FolderControl
+                            Folder="{Binding}"
                             MouseDown="SelectActiveItem"
                             MouseMove="LayerGroup_MouseMove"/>
                     </HierarchicalDataTemplate>
                     <DataTemplate DataType="{x:Type docVm:LayerViewModel}">
-                        <layerUserControls:LayerStructureItemContainer
+                        <layerUserControls:LayerControl
+                            Layer="{Binding}"
                             MouseDown="SelectActiveItem"
                             MouseMove="LayerStructureItemContainer_MouseMove"/>
                     </DataTemplate>

+ 1 - 1
src/PixiEditor/Views/UserControls/Layers/LayersManager.xaml.cs

@@ -215,7 +215,7 @@ internal partial class LayersManager : UserControl
 
     private void Grid_DragEnter(object sender, DragEventArgs e)
     {
-        ((Border)sender).BorderBrush = LayerItem.HighlightColor;
+        ((Border)sender).BorderBrush = LayerControl.HighlightColor;
     }
 
     private void Grid_DragLeave(object sender, DragEventArgs e)