149 lines
9.1 KiB
XML
149 lines
9.1 KiB
XML
<UserControl x:Class="AuroraUIComponent.UserControls.MotorStatusTableView"
|
|
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:AuroraUIComponent.UserControls"
|
|
xmlns:uiconverter="clr-namespace:AuroraUIComponent.UIConverter"
|
|
mc:Ignorable="d"
|
|
x:Name="uc"
|
|
d:DataContext="{d:DesignInstance local:MotorStatusItem}"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<UserControl.Resources>
|
|
<uiconverter:BoolToBrushConverter x:Key="StrToBrush" True="Green" False="Goldenrod"/>
|
|
<uiconverter:BoolToBrushConverter x:Key="StrToBrushGR" True="Green" False="Red"/>
|
|
<uiconverter:BoolToBrushConverter x:Key="StrToBrushLimit" True="Red" False="Green"/>
|
|
<Style TargetType="DataGridCell" x:Key="CellNoMargin">
|
|
<Setter Property="Margin" Value="0"/>
|
|
</Style>
|
|
|
|
<Style TargetType="DataGridCell" x:Key="CellCenter">
|
|
<Setter Property="Margin" Value="4 2"/>
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
<Style.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style TargetType="DataGridCell" x:Key="CellRight">
|
|
<Setter Property="Margin" Value="4 2"/>
|
|
<Setter Property="HorizontalAlignment" Value="Right"/>
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
<Style.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style TargetType="{x:Type DataGridRow}" x:Key="RowStyle">
|
|
<Setter Property="Height" Value="30"/>
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="True"/>
|
|
<Condition Property="IsSelected" Value="True"/>
|
|
<Condition Property="Selector.IsSelectionActive" Value="False"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Background" Value="{x:Null}" />
|
|
<Setter Property="BorderBrush" Value="{x:Null}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
<DataGrid ItemsSource="{Binding DataContext, ElementName=uc}" SelectionUnit="Cell" RowStyle="{StaticResource RowStyle}"
|
|
AutoGenerateColumns="False"
|
|
CanUserAddRows="False"
|
|
CanUserResizeColumns="False"
|
|
CanUserDeleteRows="False"
|
|
CanUserSortColumns="False"
|
|
Background="Transparent">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="DeviceID" Binding="{Binding DeviceId}" CellStyle="{StaticResource CellCenter}" FontSize="16" IsReadOnly="True"/>
|
|
<DataGridTextColumn Header="Axis" Binding="{Binding AxisInfo}" CellStyle="{StaticResource CellCenter}" FontSize="16" IsReadOnly="True"/>
|
|
<DataGridTextColumn Header="Current Position" Binding="{Binding CurrPos, StringFormat={}{0:F4}}" CellStyle="{StaticResource CellRight}" FontSize="16" IsReadOnly="True"/>
|
|
<DataGridTextColumn Header="Target Position" Binding="{Binding Target, StringFormat={}{0:F4}}" CellStyle="{StaticResource CellRight}" FontSize="16"/>
|
|
<DataGridTemplateColumn Header="InPosition" IsReadOnly="True" CellStyle="{StaticResource CellNoMargin}" Width="80">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="1" Background="{Binding InPos, Converter={StaticResource StrToBrush}}" Padding="4 0">
|
|
<TextBlock Text="{Binding InPos}" HorizontalAlignment="Center" FontSize="16" Foreground="White"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="Servo" IsReadOnly="True" CellStyle="{StaticResource CellNoMargin}" Width="80">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="1" Background="{Binding ServoOn, Converter={StaticResource StrToBrushGR}}" Padding="0 0">
|
|
<TextBlock Text="{Binding ServoOn}" HorizontalAlignment="Center" FontSize="16" Foreground="White"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="Home" IsReadOnly="True" CellStyle="{StaticResource CellNoMargin}" Width="80">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="1" Background="{Binding HomeState, Converter={StaticResource StrToBrushGR}}" Padding="0 0">
|
|
<TextBlock Text="{Binding HomeState}" HorizontalAlignment="Center" FontSize="16" Foreground="White"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="L Limit" IsReadOnly="True" CellStyle="{StaticResource CellNoMargin}" Width="80">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="1" Background="{Binding LLimit, Converter={StaticResource StrToBrushLimit}}" Padding="0 0">
|
|
<TextBlock Text="{Binding HomeState}" HorizontalAlignment="Center" FontSize="16" Foreground="White"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="R Limit" IsReadOnly="True" CellStyle="{StaticResource CellNoMargin}" Width="80">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="1" Background="{Binding RLimit, Converter={StaticResource StrToBrushLimit}}" Padding="0 0">
|
|
<TextBlock Text="{Binding HomeState}" HorizontalAlignment="Center" FontSize="16" Foreground="White"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="" Visibility="{Binding HomeVisible}" CellStyle="{StaticResource CellNoMargin}" Width="60">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Button Content="Home" Visibility="{Binding HomeVisible}" Command="{Binding CMD_Home}" Padding="0" Margin="1" VerticalAlignment="Center" BorderThickness="1" BorderBrush="#3f3f46">
|
|
|
|
</Button>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="" Visibility="{Binding MoveVisible}" CellStyle="{StaticResource CellNoMargin}" Width="60">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Button Content="Move" Visibility="{Binding MoveVisible}" Command="{Binding CMD_Move}" Padding="0" Margin="1" VerticalAlignment="Center" BorderThickness="1" BorderBrush="#3f3f46">
|
|
|
|
</Button>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Header="" Visibility="{Binding MoveVisible}" CellStyle="{StaticResource CellNoMargin}" Width="60">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Button Content="Stop" Visibility="{Binding MoveVisible}" Command="{Binding CMD_Stop}" Padding="0" Margin="1" VerticalAlignment="Center" BorderThickness="1" BorderBrush="#3f3f46">
|
|
|
|
</Button>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</UserControl>
|