|
- <UserControl x:Class="FryPot_DosingSystem.View.DeviceListVIew"
- 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:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
- xmlns:local="clr-namespace:FryPot_DosingSystem.View"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
- <UserControl.DataContext>
- <vm:DeviceListViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
- <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
- </ResourceDictionary.MergedDictionaries>
- </ResourceDictionary>
- </UserControl.Resources>
-
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="55"/>
- <RowDefinition Height="10"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
- <Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,13,10,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
- <Button Content="保存设置" Width="150" Height="35" Margin="0,13,10,0" Command="{Binding SaveDeviceConfig}"></Button>
- </StackPanel>
- <Line Grid.Row="1" X1="0" Y1="10" X2="1920" Y2="10" Stroke="Aqua" StrokeThickness="1" VerticalAlignment="Center"></Line>
- <Viewbox Grid.Row="2" VerticalAlignment="Top" >
- <ItemsControl ItemsSource="{Binding devices}" Padding="0,5,0,0">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel></StackPanel>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <RadioButton>
- <RadioButton.Template>
- <ControlTemplate>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition/>
- <ColumnDefinition/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
- <TextBlock Text="设备名称:" Margin="10,10,10,10" FontSize="16" ></TextBlock>
- <ComboBox ItemsSource="{Binding DataContext.DeviceName, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding DeviceName}" Width="150" FontSize="16"></ComboBox>
- </StackPanel>
- <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
- <TextBlock Text="ModBus IP:" Margin="10,10,10,10" FontSize="16" VerticalAlignment="Center"></TextBlock>
- <TextBox Width="150" FontSize="16" Text="{Binding Ip}" ></TextBox>
- </StackPanel>
- <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center">
- <TextBlock Text="Port:" FontSize="16" Margin="10,10,10,10"></TextBlock>
- <TextBox Width="150" FontSize="16" Text="{Binding Port}" Margin="0,0,10,0"></TextBox>
- </StackPanel>
- <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>
- </Grid>
- </ControlTemplate>
- </RadioButton.Template>
- </RadioButton>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Viewbox>
- </Grid>
-
- </UserControl>
|