CommunicationAddOrEditView.xaml 3.54 KB
<Window x:Class="HHECS.DAQClient.View.CommunicationView.CommunicationAddOrEditView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HHECS.DAQClient.View.CommunicationView"
        mc:Ignorable="d"
        xmlns:hc="https://handyorg.github.io/handycontrol"
        xmlns:viewmodel="clr-namespace:HHECS.DAQClient.ViewModel.CommunicationVM"
        d:DataContext="{d:DesignInstance Type=viewmodel:CommunicationAddOrEditVM}"
        Title="新增通讯配置"  Height="315" Width="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>
        <hc:UniformSpacingPanel Grid.Row="0" Spacing="5" Orientation="Vertical" HorizontalAlignment="Center" Margin="5">

            <TextBox MinWidth="260"  hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="编号" Text="{Binding CommunicationConfig.Code,UpdateSourceTrigger=PropertyChanged}" hc:InfoElement.Necessary="True" Style="{StaticResource TextBoxExtend}"/>

            <TextBox hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="名称" Text="{Binding CommunicationConfig.Name,UpdateSourceTrigger=PropertyChanged}" hc:InfoElement.Necessary="True" Style="{StaticResource TextBoxExtend}"/>

            <ComboBox ItemsSource="{Binding CommunicationTypes}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectedValue="{Binding CommunicationConfig.CommunicationType}" hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="通讯方式" hc:InfoElement.Necessary="True" Style="{StaticResource ComboBoxExtend}"/>

            <TextBox hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="IP地址" Text="{Binding CommunicationConfig.IpAddress,UpdateSourceTrigger=PropertyChanged}" hc:InfoElement.Necessary="True" Style="{StaticResource TextBoxExtend}"/>

            <TextBox hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="端口号" Text="{Binding CommunicationConfig.Port,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}"/>

            <ComboBox hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="是否启用" SelectedValuePath="Tag" SelectedValue="{Binding CommunicationConfig.Disable,UpdateSourceTrigger=PropertyChanged}" hc:InfoElement.Necessary="True" Style="{StaticResource ComboBoxExtend}">
                <ComboBoxItem Content="启用" Tag="False"/>
                <ComboBoxItem Content="禁用" Tag="True"/>
            </ComboBox>
            <TextBox hc:InfoElement.TitleWidth="70" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="备注" Text="{Binding CommunicationConfig.Remark,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}"/>
        </hc:UniformSpacingPanel>

        <hc:UniformSpacingPanel  Grid.Row="1" Spacing="60" HorizontalAlignment="Center">
            <Button Content="保存" Command="{Binding SaveCommand}" Style="{StaticResource ButtonPrimary}"/>
            <Button Content="取消" Command="{Binding CancelCommand}" Style="{StaticResource ButtonDefault}"/>
        </hc:UniformSpacingPanel>
    </Grid>
</Window>