CommunicationPage.xaml 5.11 KB
<Page x:Class="HHECS.DAQClient.View.CommunicationsView.CommunicationPage"
      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:local="clr-namespace:HHECS.DAQClient.View.CommunicationsView"
      xmlns:hc="https://handyorg.github.io/handycontrol"
      mc:Ignorable="d" 
      xmlns:viewmodel="clr-namespace:HHECS.DAQClient.ViewModel.CommunicationVM"
      d:DataContext="{d:DesignInstance Type=viewmodel:CommunicationVM}"
      d:DesignHeight="450" d:DesignWidth="800"
      Title="CommunicationPage">

    <DockPanel>
        <StackPanel DockPanel.Dock="Top">
            <hc:UniformSpacingPanel Spacing="10">
                <hc:ElementGroup VerticalAlignment="Center" Height="30" Margin="0,1" Layout="Stack">
                    <Border Style="{StaticResource BorderRegion}" Padding="6,0">
                        <TextBlock Text="编号" Width="50" VerticalAlignment="Center"/>
                    </Border>
                    <TextBox Text="{Binding Code,UpdateSourceTrigger=PropertyChanged}" MinWidth="150"/>
                </hc:ElementGroup>
                <hc:ElementGroup VerticalAlignment="Center" Height="30" Layout="Stack">
                    <Border Style="{StaticResource BorderRegion}" Padding="6,0">
                        <TextBlock Text="名称" Width="50" VerticalAlignment="Center"/>
                    </Border>
                    <hc:AutoCompleteTextBox MinWidth="150" VerticalAlignment="Center" HorizontalAlignment="Center" ItemsSource="{Binding NameItems}" Text="{Binding Name}"/>
                </hc:ElementGroup>
                <hc:ElementGroup VerticalAlignment="Center" Height="30" Layout="Stack">
                    <Border Style="{StaticResource BorderRegion}" Padding="6,0">
                        <TextBlock Text="通讯方式" Width="50" VerticalAlignment="Center"/>
                    </Border>
                    <hc:CheckComboBox Name="SysOrgCbx" MinWidth="150" MaxWidth="200" ItemsSource="{Binding SysOrgCodeItems}" Style="{StaticResource CheckComboBoxExtend}" ShowSelectAllButton="True" />
                </hc:ElementGroup>
            </hc:UniformSpacingPanel>
            <ToolBar Header="操作" Padding="4" Margin="0,1" HorizontalAlignment="Right">
                <hc:UniformSpacingPanel Spacing="5">
                    <Button Content="搜索" Command="{Binding SerachCommand}" CommandParameter="{Binding ElementName=SysOrgCbx,Path=SelectedItems}" Style="{StaticResource ButtonDefault.Small}" hc:IconElement.Geometry="{StaticResource SearchGeometry}"/>
                    <Button Content="新增" Command="{Binding AddCommand}" CommandParameter="{Binding ElementName=SysOrgCbx,Path=SelectedItems}" Style="{StaticResource ButtonDefault.Small}" hc:IconElement.Geometry="{StaticResource AddGeometry}"/>
                    <Button Content="编辑" Command="{Binding EditCommand}" CommandParameter="{Binding ElementName=SysOrgCbx,Path=SelectedItems}" Style="{StaticResource ButtonDefault.Small}" hc:IconElement.Geometry="{StaticResource DropperGeometry}"/>
                    <Button Content="删除" Command="{Binding DeleteCommand}" CommandParameter="{Binding ElementName=SysOrgCbx,Path=SelectedItems}" Style="{StaticResource ButtonDefault.Small}" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"/>
                </hc:UniformSpacingPanel>
            </ToolBar>
        </StackPanel>
        <hc:Pagination DockPanel.Dock="Bottom" MaxPageCount="{Binding MaxPage}" PageIndex="{Binding PageIndex}" DataCountPerPage="{Binding PageSize}" IsJumpEnabled="True">
            <hc:Interaction.Triggers>
                <hc:EventTrigger EventName="PageUpdated">
                    <hc:EventToCommand Command="{Binding PageUpdatedCommand}" PassEventArgsToCommand="True" />
                </hc:EventTrigger>
            </hc:Interaction.Triggers>
        </hc:Pagination>
        <DataGrid Style="{StaticResource DataGrid.Small}" IsReadOnly="True" hc:DataGridAttach.CanUnselectAllWithBlankArea="True" HeadersVisibility="All" RowHeaderWidth="60" AutoGenerateColumns="False" ItemsSource="{Binding CommunicationConfigs}" hc:DataGridAttach.ShowRowNumber="True">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Id}" Header="Id" Visibility="Hidden"/>
                <DataGridTextColumn Binding="{Binding Code}" Header="编号"/>
                <DataGridTextColumn Binding="{Binding Name}" Header="名称"/>
                <DataGridTextColumn Binding="{Binding CommunicationType}" Header="类型"/>
                <DataGridTextColumn Binding="{Binding IpAddress}" Header="IP地址"/>
                <DataGridTextColumn Binding="{Binding Port}" Header="端口号"/>
                <DataGridTextColumn Binding="{Binding Disable}" Header="是否禁用"/>
                <DataGridTextColumn Binding="{Binding Remark}" Header="备注"/>
                <DataGridTextColumn Binding="{Binding Area}" Header="区域"/>
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Page>