Files
EgtCAM5/MTableDb/MTableDbView.xaml
T
Emmanuele Sassi 172b45cf35 EgtCAM5 :
- Aggiunte moltefunzionalità di gestione tabelle per Doors.
- Migliorata la Behaviour di Scroll per ListBox e aggiunta quella per DataGrid
2016-10-14 18:51:15 +00:00

277 lines
15 KiB
XML

<EgtWPFLib5:EgtCustomWindow x:Class="MTableDbView"
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:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
Title="{Binding Title}" Icon="/Resources/EgtCAM5.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}"
BorderBrush="{StaticResource EgaltechBlue1}"
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="11*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Command="{Binding NewTableCommand}" ToolTip="{Binding NewTableToolTip}"
Style="{StaticResource MTableWindowButton}">
<Image Source="/Resources/TopCommandBar/New.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveTableCommand}" ToolTip="{Binding SaveTableToolTip}"
Style="{StaticResource MTableWindowButton}">
<Image Source="/Resources/TopCommandBar/Save.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding SaveTableAsCommand}" ToolTip="{Binding SaveAsTableToolTip}"
Style="{StaticResource MTableWindowButton}">
<Image Source="/Resources/TopCommandBar/SaveAs.png" Stretch="Uniform"/>
</Button>
<Button Content="X" Command="{Binding RemoveTableCommand}" ToolTip="{Binding RemoveTableToolTip}"
Style="{StaticResource MTableWindowButton}"/>
</StackPanel>
<ListBox Name="TablesListBox" Grid.Row="1" ItemsSource="{Binding Path=TablesList}"
SelectedItem="{Binding SelectedTable}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TableName}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="11*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="1" Header="Active Machines List" BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="2"
Padding="3" Margin="2,2,2,2">
<ItemsControl Name="MachineList"
ItemsSource="{Binding Path=SelectedItem.ActiveMachinesList, ElementName=TablesListBox}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,2,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding MachId}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="MachineName"/>
<ComboBox Grid.Column="2" ItemsSource="{Binding MachinesList}"
SelectedItem="{Binding SelectedMachine}"/>
<TextBlock Grid.Column="3" Text="NcGenerate" HorizontalAlignment="Center"/>
<CheckBox Grid.Column="4" IsChecked="{Binding NcGenerate}" HorizontalAlignment="Right"/>
<TextBlock Grid.Column="5" Text="MakeRaw" HorizontalAlignment="Center"/>
<CheckBox Grid.Column="6" IsChecked="{Binding Makeraw}" HorizontalAlignment="Right"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GroupBox>
<DataGrid Name="AssociationDataGrid"
ItemsSource="{Binding Path=SelectedItem.AssociationList,
ElementName=TablesListBox}"
SelectedItem="{Binding Path=SelectedItem.SelectedAssociation,
ElementName=TablesListBox,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
IsSynchronizedWithCurrentItem="True"
Grid.Row="2"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
CanUserReorderColumns="False"
SelectionMode="Single"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto">
<Interactivity:Interaction.Behaviors>
<EgtCAM5:ScrollIntoViewForDataGrid/>
</Interactivity:Interaction.Behaviors>
<DataGrid.Columns>
<!--Colonna On-->
<DataGridCheckBoxColumn Header="On" Width="Auto" Binding="{Binding OnPar}"/>
<!--Colonna Name-->
<DataGridTemplateColumn Header="Name" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=NamesList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Operation-->
<DataGridTemplateColumn Header="Operation" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Oper,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=OperationsList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Oper,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Machine Id-->
<DataGridTemplateColumn Header="MId" Width="Auto">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding MachId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=SelectedItem.MachIdList,ElementName=TablesListBox,Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=MachId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Shift-->
<DataGridTemplateColumn Header="Shift" Width="Auto">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Shift,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=ShiftList,ElementName=TablesListBox,Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Shift,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna MachiningType-->
<DataGridTemplateColumn Header="Machining Type" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding SelectedMachType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=MachTypeList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="TypeName"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=SelectedMachType.TypeName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Machining-->
<DataGridTemplateColumn Header="Machining" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding Mach,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=MachList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Mach,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Machining Up-->
<DataGridTemplateColumn Header="Machining Up" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding MachUp,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=MachList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=MachUp,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--Colonna Machining Down-->
<DataGridTemplateColumn Header="Machining Down" Width="1*">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox IsEditable="False"
SelectedItem="{Binding MachDw,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Path=MachList, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=MachDw,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<UniformGrid Grid.Row="3" Columns="6">
<Button Content="Add Mach" Command="{Binding AddMachCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
<Button Content="Remove Mach" Command="{Binding RemoveMachCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
<Button Content="Add Machining" Command="{Binding AddRowCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
<Button Content="Remove Machining" Command="{Binding RemoveRowCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
<Button Content="/\" Command="{Binding MoveRowUpCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
<Button Content="\/" Command="{Binding MoveRowDownCommand}"
CommandParameter="{Binding Path=SelectedItem, ElementName=MachiningsTreeView}"/>
</UniformGrid>
</Grid>
</Grid>
</EgtWPFLib5:EgtCustomWindow>