终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

73 lignes
4.5 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="50"/>
  24. <RowDefinition Height="20"/>
  25. <RowDefinition/>
  26. </Grid.RowDefinitions>
  27. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  28. <Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
  29. <Button Content="保存设置" Width="150" Height="35" Margin="0,0,20,0" Command="{Binding SaveDeviceConfig}"></Button>
  30. </StackPanel>
  31. <Line Grid.Row="1" X1="0" Y1="10" X2="1300" Y2="10" Stroke="Aqua" StrokeThickness="1"></Line>
  32. <ItemsControl Grid.Row="2" ItemsSource="{Binding devices}">
  33. <ItemsControl.ItemsPanel>
  34. <ItemsPanelTemplate>
  35. <StackPanel></StackPanel>
  36. </ItemsPanelTemplate>
  37. </ItemsControl.ItemsPanel>
  38. <ItemsControl.ItemTemplate>
  39. <DataTemplate>
  40. <RadioButton>
  41. <RadioButton.Template>
  42. <ControlTemplate>
  43. <Grid>
  44. <Grid.ColumnDefinitions>
  45. <ColumnDefinition/>
  46. <ColumnDefinition/>
  47. <ColumnDefinition/>
  48. <ColumnDefinition/>
  49. </Grid.ColumnDefinitions>
  50. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  51. <TextBlock Text="设备名称:" Margin="10,10,10,10" FontSize="16" ></TextBlock>
  52. <ComboBox ItemsSource="{Binding DataContext.DeviceName, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding DeviceName}" Width="150" FontSize="16"></ComboBox>
  53. </StackPanel>
  54. <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
  55. <TextBlock Text="ModBus IP:" Margin="10,10,10,10" FontSize="16" VerticalAlignment="Center"></TextBlock>
  56. <TextBox Width="150" FontSize="16" Text="{Binding Ip}" ></TextBox>
  57. </StackPanel>
  58. <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
  59. <TextBlock Text="Port:" FontSize="16" Margin="10,10,10,10"></TextBlock>
  60. <TextBox Width="150" FontSize="16" Text="{Binding Port}"></TextBox>
  61. </StackPanel>
  62. <Button Grid.Column="3" Content="删除" Width="150" Height="30" FontSize="16" Command="{Binding DataContext.DeleteDevice,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding DeviceNum}"></Button>
  63. </Grid>
  64. </ControlTemplate>
  65. </RadioButton.Template>
  66. </RadioButton>
  67. </DataTemplate>
  68. </ItemsControl.ItemTemplate>
  69. </ItemsControl>
  70. </Grid>
  71. </UserControl>