S7WriteView.xaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <UserControl x:Class="S7NetModule.Views.S7WriteView"
  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:local="clr-namespace:S7NetModule.Views"
  7. mc:Ignorable="d"
  8. xmlns:prism="http://prismlibrary.com/"
  9. prism:ViewModelLocator.AutoWireViewModel="True"
  10. d:DesignHeight="450" d:DesignWidth="300">
  11. <UserControl.Resources>
  12. <Style x:Key="TextBlackStyle"
  13. TargetType="TextBlock">
  14. <Setter Property="FontSize"
  15. Value="15" />
  16. <Setter Property="Foreground"
  17. Value="White" />
  18. <Setter Property="Margin"
  19. Value="0,0,15,0" />
  20. <Setter Property="TextAlignment"
  21. Value="Right" />
  22. <Setter Property="Width"
  23. Value="80" />
  24. </Style>
  25. </UserControl.Resources>
  26. <Border>
  27. <Grid>
  28. <Grid.RowDefinitions>
  29. <RowDefinition Height="50" />
  30. <RowDefinition Height="50" />
  31. <RowDefinition Height="50" />
  32. <RowDefinition Height="50" />
  33. <RowDefinition Height="50" />
  34. <RowDefinition Height="50" />
  35. <RowDefinition />
  36. </Grid.RowDefinitions>
  37. <!-- DB号 -->
  38. <StackPanel Orientation="Horizontal"
  39. VerticalAlignment="Center"
  40. Grid.Row="0">
  41. <TextBlock Text="DB号:"
  42. Style="{ StaticResource TextBlackStyle}" />
  43. <TextBox Width="150"
  44. Name="ip"
  45. Text="{Binding Write_Model.Db}" />
  46. </StackPanel>
  47. <!-- 起始地址 -->
  48. <StackPanel Orientation="Horizontal"
  49. VerticalAlignment="Center"
  50. Grid.Row="1">
  51. <TextBlock Text="起始地址:"
  52. Style="{ StaticResource TextBlackStyle}" />
  53. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  54. Text="{Binding Write_Model.StartByteAdr}" />
  55. </StackPanel>
  56. <!-- 数据个数 -->
  57. <StackPanel Orientation="Horizontal"
  58. VerticalAlignment="Center"
  59. Grid.Row="2">
  60. <TextBlock Text="数据类型:"
  61. Style="{ StaticResource TextBlackStyle}" />
  62. <ComboBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  63. ItemsSource="{Binding DataTypes}"
  64. Text="{Binding Write_Model.VarType}" />
  65. </StackPanel>
  66. <!-- 数据个数 -->
  67. <StackPanel Orientation="Horizontal"
  68. VerticalAlignment="Center"
  69. Grid.Row="3">
  70. <TextBlock Text="数据:"
  71. Style="{ StaticResource TextBlackStyle}" />
  72. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  73. Text="{Binding Write_Model.Value}" />
  74. </StackPanel>
  75. <!-- bit位 -->
  76. <StackPanel Orientation="Horizontal"
  77. VerticalAlignment="Center"
  78. Grid.Row="4">
  79. <TextBlock Text="bit位:"
  80. Style="{ StaticResource TextBlackStyle}" />
  81. <TextBox Width="{Binding ElementName=ip,Path=ActualWidth}"
  82. Text="{Binding Write_Model.BitAdr}" />
  83. </StackPanel>
  84. <StackPanel Orientation="Horizontal"
  85. Width="{Binding ElementName=ip,Path=ActualWidth}"
  86. VerticalAlignment="Center"
  87. HorizontalAlignment="Right"
  88. Grid.Row="5">
  89. <Button Content="写入"
  90. Width="60"
  91. Height="35"
  92. Command="{Binding S7Writecommand}" />
  93. </StackPanel>
  94. </Grid>
  95. </Border>
  96. </UserControl>