c37d2269b6
- Cambio stile expander. - Migliorie varie.
86 lines
5.1 KiB
XML
86 lines
5.1 KiB
XML
<UserControl x:Class="ManageLayerExpanderView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
|
xmlns:expression="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
|
|
xmlns:local="clr-namespace:EgtCAM5">
|
|
|
|
<Expander IsExpanded="True" Style="{StaticResource ExpanderStyle}">
|
|
<Expander.Header>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="{Binding HeaderName}" Margin="0,0,5,0"/>
|
|
<Ellipse Height="10" Width="10" Fill="{Binding HeaderColor}" />
|
|
</StackPanel>
|
|
</Expander.Header>
|
|
|
|
<StackPanel>
|
|
|
|
<UniformGrid Rows="1">
|
|
<Button Content="New Part" Command="{Binding NewPartCommand}" Height="30"/>
|
|
<Button Content="New Layer" Command="{Binding NewLayerCommand}" Height="30"/>
|
|
<Button Content="Color" Command="{Binding LayerColorCommand}" Height="30"/>
|
|
</UniformGrid>
|
|
<TreeView Name="LayerTreeView" MinHeight="150" MaxHeight="250"
|
|
ItemsSource="{Binding Path=LayerList}">
|
|
<interactivity:Interaction.Triggers>
|
|
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
|
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}"/>
|
|
</interactivity:EventTrigger>
|
|
</interactivity:Interaction.Triggers>
|
|
<TreeView.Resources>
|
|
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
|
|
<HierarchicalDataTemplate DataType="{x:Type local:LayerTreeViewItem}" ItemsSource="{Binding Items}">
|
|
<Grid>
|
|
<interactivity:Interaction.Triggers>
|
|
<interactivity:EventTrigger EventName="MouseUp">
|
|
<interactivity:InvokeCommandAction Command="{Binding TreeViewMouseUpCommand}" CommandParameter="{Binding ElementName=LayerTreeView,Path=SelectedItem}"/>
|
|
</interactivity:EventTrigger>
|
|
<interactivity:EventTrigger EventName="PreviewMouseRightButtonDown">
|
|
<expression:ChangePropertyAction PropertyName="IsRightSelected" Value="true" TargetObject="{Binding}"/>
|
|
</interactivity:EventTrigger>
|
|
</interactivity:Interaction.Triggers>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="1*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="0" IsChecked="{Binding OnOff}" Focusable="False" Height="15" Width="15" Margin="0,0,5,0"/>
|
|
<Image Grid.Column="1" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
|
|
<TextBlock Grid.Column="2" Text="{Binding Name}" Margin="0,0,5,0"/>
|
|
<Ellipse Grid.Column="3" Height="10" Width="10" Fill="{Binding LayerColor}" />
|
|
|
|
</Grid>
|
|
</HierarchicalDataTemplate>
|
|
</TreeView.Resources>
|
|
|
|
<!--Style dei nodi CathegoryItem che li riquadra di azzurro quando clicckati ed elimina l'ombra grigia
|
|
che si presenta quando la categoria rimane vuota (ombra causata dal multibinding).-->
|
|
<TreeView.ItemContainerStyle>
|
|
<Style TargetType="{x:Type TreeViewItem}">
|
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
<Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
</Style>
|
|
</TreeView.ItemContainerStyle>
|
|
<TreeView.ContextMenu>
|
|
<ContextMenu>
|
|
<MenuItem Header="Select" Command="{Binding SelectCommand}"/>
|
|
<MenuItem Header="Deselect" Command="{Binding DeselectCommand}"/>
|
|
<Separator/>
|
|
<MenuItem Header="Name" Command="{Binding NameCommand}"/>
|
|
<MenuItem Header="Info" Command="{Binding InfoCommand}"/>
|
|
<Separator/>
|
|
<MenuItem Header="Relocate" Command="{Binding RelocateCommand}"/>
|
|
<MenuItem Header="Copy" Command="{Binding CopyCommand}"/>
|
|
<MenuItem Header="Delete" Command="{Binding DeleteCommand}"/>
|
|
<MenuItem Header="Save" Command="{Binding SaveCommand}"/>
|
|
</ContextMenu>
|
|
</TreeView.ContextMenu>
|
|
</TreeView>
|
|
</StackPanel>
|
|
</Expander>
|
|
</UserControl>
|