Files
EgtWPFLib5/MachGroupPanel/MachGroupPanelV.xaml
T
Emmanuele Sassi f325ea4bdf EgtWpfLib :
- Agiunti pannelli, StatusBar e scena generici per uso comune.
- Miglioramenti vari.
2017-11-25 17:01:25 +00:00

105 lines
5.8 KiB
XML

<EgtFloating:EgtFloatingPanel x:Class="EgtMachGroupPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating"
Visibility="{Binding MachGroupPanel_Visibility}">
<EgtFloating:EgtFloatingPanel.Resources>
<SolidColorBrush x:Key="ListBox.Static.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListBox.Static.Border" Color="#FFABADB3"/>
<SolidColorBrush x:Key="ListBox.Disabled.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListBox.Disabled.Border" Color="#FFD9D9D9"/>
<Style x:Key="MachiningGroupListBox" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</EgtFloating:EgtFloatingPanel.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding MachGroupList}" SelectedItem="{Binding SelectedMachGroup}"
Style="{StaticResource MachiningGroupListBox}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="MachiningGroups"
Height="30" MaxWidth="150" Padding="5,0,5,0"
ToolTip="{Binding MachGroupToolTip}"
Style="{Binding MachGroupButtonStyle,RelativeSource={RelativeSource AncestorType={x:Type EgtFloating:EgtFloatingPanel}}}"
IsChecked="{Binding Path=IsSelected,
RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}},
Mode=TwoWay}"
IsEnabled="{Binding IsEnabled}">
<RadioButton.Content>
<TextBlock Text="{Binding Name}"/>
</RadioButton.Content>
</RadioButton>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true">
<EgtWPFLib5:EgtScrollViewer IsPageSlideCommand="True" Focusable="false" Padding="{TemplateBinding Padding}" IsCustom="True" Orientation="Horizontal" RepeatButtonDimension="20"
RepeatButtonStyle="{Binding RepaetButtonStyle,RelativeSource={RelativeSource AncestorType={x:Type EgtFloating:EgtFloatingPanel}}}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</EgtWPFLib5:EgtScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource ListBox.Disabled.Border}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
<!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ListBox.Template>
</ListBox>
<Button Content="+" Height="20" Width="20" VerticalAlignment="Center" Focusable="False"
Margin="3,0,5,0" Command="{Binding AddMachGroupCommand}" Grid.Column="1"
IsEnabled="{Binding IsEnabledAddRemove}"/>
<Button Content="-" Height="20" Width="20" VerticalAlignment="Center" Focusable="False"
Margin="0,0,5,0" Command="{Binding RemoveMachGroupCommand}" Grid.Column="2"
IsEnabled="{Binding IsEnabledAddRemove}"/>
</Grid>
</EgtFloating:EgtFloatingPanel>