终端一体化运控平台
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

77 líneas
4.9 KiB

  1. <UserControl x:Class="FryPot_DosingSystem.View.DeviceListVIew"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  7. xmlns:local="clr-namespace:FryPot_DosingSystem.View"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <UserControl.DataContext>
  11. <vm:DeviceListViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <ResourceDictionary>
  15. <ResourceDictionary.MergedDictionaries>
  16. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
  17. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
  18. </ResourceDictionary.MergedDictionaries>
  19. </ResourceDictionary>
  20. </UserControl.Resources>
  21. <Grid>
  22. <Grid.RowDefinitions>
  23. <RowDefinition Height="55"/>
  24. <RowDefinition Height="10"/>
  25. <RowDefinition/>
  26. </Grid.RowDefinitions>
  27. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  28. <Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,13,10,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
  29. <Button Content="保存设置" Width="150" Height="35" Margin="0,13,10,0" Command="{Binding SaveDeviceConfig}"></Button>
  30. </StackPanel>
  31. <Line Grid.Row="1" X1="0" Y1="10" X2="1920" Y2="10" Stroke="Aqua" StrokeThickness="1" VerticalAlignment="Center"></Line>
  32. <Viewbox Grid.Row="2" VerticalAlignment="Top" >
  33. <ItemsControl ItemsSource="{Binding devices}" Padding="0,5,0,0">
  34. <ItemsControl.ItemsPanel>
  35. <ItemsPanelTemplate>
  36. <StackPanel></StackPanel>
  37. </ItemsPanelTemplate>
  38. </ItemsControl.ItemsPanel>
  39. <ItemsControl.ItemTemplate>
  40. <DataTemplate>
  41. <RadioButton>
  42. <RadioButton.Template>
  43. <ControlTemplate>
  44. <Grid>
  45. <Grid.ColumnDefinitions>
  46. <ColumnDefinition/>
  47. <ColumnDefinition/>
  48. <ColumnDefinition/>
  49. <ColumnDefinition/>
  50. </Grid.ColumnDefinitions>
  51. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  52. <TextBlock Text="设备名称:" Margin="10,10,10,10" FontSize="16" ></TextBlock>
  53. <ComboBox ItemsSource="{Binding DataContext.DeviceName, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding DeviceName}" Width="150" FontSize="16"></ComboBox>
  54. </StackPanel>
  55. <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
  56. <TextBlock Text="ModBus IP:" Margin="10,10,10,10" FontSize="16" VerticalAlignment="Center"></TextBlock>
  57. <TextBox Width="150" FontSize="16" Text="{Binding Ip}" ></TextBox>
  58. </StackPanel>
  59. <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
  60. <TextBlock Text="Port:" FontSize="16" Margin="10,10,10,10"></TextBlock>
  61. <TextBox Width="150" FontSize="16" Text="{Binding Port}" Margin="0,0,10,0"></TextBox>
  62. </StackPanel>
  63. <Button Grid.Column="3" Content="删除" Width="150" Height="30" FontSize="16" Margin="0,0,10,0" Command="{Binding DataContext.DeleteDevice,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding DeviceNum}"></Button>
  64. </Grid>
  65. </ControlTemplate>
  66. </RadioButton.Template>
  67. </RadioButton>
  68. </DataTemplate>
  69. </ItemsControl.ItemTemplate>
  70. </ItemsControl>
  71. </Viewbox>
  72. </Grid>
  73. </UserControl>