mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Brush properties - Added default values Brush properties - Removed option to always auto-expand groups Layer properties - Remember expanded/collapsed groups Storage - Added migration system Storage - Added migration that removes profiles made in the old layer properties format Layer timeline - Added back zoom functionality
110 lines
7.1 KiB
XML
110 lines
7.1 KiB
XML
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree.TreeView"
|
|
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:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree"
|
|
xmlns:s="https://github.com/canton7/Stylet"
|
|
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
|
xmlns:abstract="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract"
|
|
xmlns:layerProperties="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="450" d:DesignWidth="800"
|
|
d:DataContext="{d:DesignInstance {x:Type local:TreeViewModel}}">
|
|
<UserControl.Resources>
|
|
<Style x:Key="PropertyTreeStyle" TargetType="{x:Type TreeViewItem}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
|
<ControlTemplate.Resources>
|
|
<converters:LeftMarginMultiplierConverter Length="19" x:Key="lengthConverter" />
|
|
</ControlTemplate.Resources>
|
|
<StackPanel>
|
|
<Border Name="Bd"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{DynamicResource MaterialDesignDivider}"
|
|
BorderThickness="0,0,0,1"
|
|
Height="25"
|
|
Padding="{TemplateBinding Padding}">
|
|
<Grid Margin="{Binding Converter={StaticResource lengthConverter}, RelativeSource={RelativeSource TemplatedParent}}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="19" />
|
|
<ColumnDefinition />
|
|
</Grid.ColumnDefinitions>
|
|
<ToggleButton x:Name="Expander"
|
|
Foreground="{DynamicResource MaterialDesignBody}"
|
|
Style="{StaticResource MaterialDesignExpandCollapseToggleStyle}"
|
|
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
|
|
ClickMode="Press" />
|
|
|
|
<ContentPresenter x:Name="PART_Header"
|
|
Grid.Column="1"
|
|
ContentSource="Header"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
|
</Grid>
|
|
</Border>
|
|
<ItemsPresenter x:Name="ItemsHost" />
|
|
</StackPanel>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsExpanded" Value="false">
|
|
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="HasItems" Value="false">
|
|
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="HasHeader" Value="false" />
|
|
<Condition Property="Width" Value="Auto" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
|
|
</MultiTrigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="HasHeader" Value="false" />
|
|
<Condition Property="Height" Value="Auto" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
<TreeView ItemsSource="{Binding LayerPropertyGroups}"
|
|
VirtualizingStackPanel.IsVirtualizing="True"
|
|
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
|
HorizontalContentAlignment="Stretch"
|
|
Background="{DynamicResource MaterialDesignToolBarBackground}"
|
|
PreviewMouseWheel="{s:Action PropertyTreePreviewMouseWheel}"
|
|
Margin="0 -1">
|
|
<TreeView.ItemContainerStyle>
|
|
<Style TargetType="TreeViewItem" BasedOn="{StaticResource PropertyTreeStyle}">
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
|
<Setter Property="Visibility" Value="{Binding IsVisible, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
|
</Style>
|
|
</TreeView.ItemContainerStyle>
|
|
<TreeView.Resources>
|
|
<HierarchicalDataTemplate DataType="{x:Type layerProperties:LayerPropertyGroupViewModel}" ItemsSource="{Binding Children}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="{Binding PropertyGroupDescription.Name}"
|
|
ToolTip="{Binding PropertyGroupDescription.Description}" Margin="5 0"
|
|
VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
</HierarchicalDataTemplate>
|
|
<DataTemplate DataType="{x:Type layerProperties:LayerPropertyViewModel}">
|
|
<ContentControl s:View.Model="{Binding TreePropertyBaseViewModel}" />
|
|
</DataTemplate>
|
|
</TreeView.Resources>
|
|
</TreeView>
|
|
</UserControl> |