|
@@ -4,70 +4,105 @@
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:PixiEditor.Views.UserControls"
|
|
xmlns:local="clr-namespace:PixiEditor.Views.UserControls"
|
|
- xmlns:vws="clr-namespace:PixiEditor.Views" xmlns:ui="clr-namespace:PixiEditor.Helpers.UI"
|
|
|
|
|
|
+ xmlns:vws="clr-namespace:PixiEditor.Views" xmlns:ui="clr-namespace:PixiEditor.Helpers.UI" xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
|
|
mc:Ignorable="d"
|
|
mc:Ignorable="d"
|
|
- d:DesignHeight="60" d:DesignWidth="250" Name="uc">
|
|
|
|
- <Grid>
|
|
|
|
- <ItemsControl Name="itemsControl" ItemsSource="{Binding Item.Children, ElementName=uc}">
|
|
|
|
|
|
+ d:DesignHeight="60" d:DesignWidth="250" Name="layerStructureContainer">
|
|
|
|
+ <UserControl.Resources>
|
|
|
|
+ <converters:IndexOfConverter x:Key="IndexOfConverter"/>
|
|
|
|
+ </UserControl.Resources>
|
|
|
|
+ <ItemsControl Name="itemsControl" ItemsSource="{Binding Item.Children, ElementName=layerStructureContainer}" AlternationCount="9999">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<ItemsPanelTemplate>
|
|
- <ui:ReversedOrderStackPanel Orientation="Vertical" />
|
|
|
|
|
|
+ <ui:ReversedOrderStackPanel Orientation="Vertical"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<DataTemplate>
|
|
- <vws:LayerItem Tag="{Binding Path=DataContext, ElementName=layersItemsControl}"
|
|
|
|
- LayerIndex="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}"
|
|
|
|
- SetActiveLayerCommand="{Binding DataContext.LayersViewModel.SetActiveLayerCommand,
|
|
|
|
- ElementName=layersItemsControl}"
|
|
|
|
|
|
+ <vws:LayerItem Tag="{Binding ElementName=layerStructureContainer}"
|
|
|
|
+ SetActiveLayerCommand="{Binding LayerCommandsViewModel.SetActiveLayerCommand, ElementName=layerStructureContainer}"
|
|
LayerName="{Binding Name, Mode=TwoWay}"
|
|
LayerName="{Binding Name, Mode=TwoWay}"
|
|
IsActive="{Binding IsActive, Mode=TwoWay}"
|
|
IsActive="{Binding IsActive, Mode=TwoWay}"
|
|
IsRenaming="{Binding IsRenaming, Mode=TwoWay}"
|
|
IsRenaming="{Binding IsRenaming, Mode=TwoWay}"
|
|
PreviewImage="{Binding LayerBitmap}"
|
|
PreviewImage="{Binding LayerBitmap}"
|
|
- MoveToBackCommand="{Binding DataContext.LayersViewModel.MoveToBackCommand, ElementName=layersItemsControl}"
|
|
|
|
- MoveToFrontCommand="{Binding DataContext.LayersViewModel.MoveToFrontCommand, ElementName=layersItemsControl}">
|
|
|
|
- <vws:LayerItem.ContextMenu>
|
|
|
|
- <ContextMenu>
|
|
|
|
- <MenuItem Header="Delete"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.DeleteLayersCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- <MenuItem Header="Rename"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.RenameLayerCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- <MenuItem Header="Move to front"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.MoveToFrontCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- <MenuItem Header="Move to back"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.MoveToBackCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- <Separator/>
|
|
|
|
- <MenuItem Header="Merge selected"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.MergeSelectedCommand,
|
|
|
|
|
|
+ LayerColor="{Binding LayerHighlightColor}"
|
|
|
|
+ MoveToBackCommand="{Binding LayerCommandsViewModel.MoveToBackCommand, ElementName=layerStructureContainer}"
|
|
|
|
+ MoveToFrontCommand="{Binding LayerCommandsViewModel.MoveToFrontCommand, ElementName=layerStructureContainer}">
|
|
|
|
+ <vws:LayerItem.LayerIndex>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="ContainerIndex" ElementName="layerStructureContainer" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </vws:LayerItem.LayerIndex>
|
|
|
|
+ <vws:LayerItem.ContextMenu>
|
|
|
|
+ <ContextMenu>
|
|
|
|
+ <MenuItem Header="Delete"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.DeleteLayersCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ <MenuItem Header="Rename"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.RenameLayerCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ <MenuItem Header="Move to front"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToFrontCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ <MenuItem Header="Move to back"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MoveToBackCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ <Separator/>
|
|
|
|
+ <MenuItem Header="Merge selected"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeSelectedCommand,
|
|
RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
|
RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
|
- <MenuItem Header="Merge with above"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.MergeWithAboveCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- <MenuItem Header="Merge with below"
|
|
|
|
- Command="{Binding PlacementTarget.Tag.LayersViewModel.MergeWithBelowCommand,
|
|
|
|
- RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
|
|
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
|
|
|
|
- Path=(ItemsControl.AlternationIndex)}" />
|
|
|
|
- </ContextMenu>
|
|
|
|
- </vws:LayerItem.ContextMenu>
|
|
|
|
- </vws:LayerItem>
|
|
|
|
|
|
+ <MenuItem Header="Merge with above"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithAboveCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ <MenuItem Header="Merge with below"
|
|
|
|
+ Command="{Binding PlacementTarget.Tag.LayerCommandsViewModel.MergeWithBelowCommand,
|
|
|
|
+ RelativeSource={RelativeSource AncestorType=ContextMenu}}">
|
|
|
|
+ <MenuItem.CommandParameter>
|
|
|
|
+ <MultiBinding Converter="{StaticResource IndexOfConverter}">
|
|
|
|
+ <Binding Path="PlacementTarget.Tag.ContainerIndex" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
|
|
|
+ <Binding Path="(ItemsControl.AlternationIndex)" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
|
|
+ </MultiBinding>
|
|
|
|
+ </MenuItem.CommandParameter>
|
|
|
|
+ </MenuItem>
|
|
|
|
+ </ContextMenu>
|
|
|
|
+ </vws:LayerItem.ContextMenu>
|
|
|
|
+ </vws:LayerItem>
|
|
</DataTemplate>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ItemsControl>
|
|
- </Grid>
|
|
|
|
</UserControl>
|
|
</UserControl>
|