EquipmentPropMonitor.xaml 6.13 KB
<Window
    x:Class="HHECS.DAQClient.View.EquipmentPropView.EquipmentPropMonitor"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:HHECS.DAQClient.View.EquipmentPropView"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:HHECS.DAQClient.ViewModel.EquipmentPropVM"
    Title="属性数据"
    Width="800"
    Height="450"
    d:DataContext="{d:DesignInstance Type=viewmodel:EquipmentPropMonitorVM}"
    Closing="Window_Closing"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <DockPanel>
        <StackPanel DockPanel.Dock="Top">
            <hc:UniformSpacingPanel Spacing="10">
                <hc:ElementGroup
                    Height="30"
                    Margin="0,1"
                    VerticalAlignment="Center"
                    Layout="Stack">
                    <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                        <TextBlock
                            Width="50"
                            VerticalAlignment="Center"
                            Text="属性编号" />
                    </Border>
                    <TextBox MinWidth="150" Text="{Binding EquipmentPropCode, UpdateSourceTrigger=PropertyChanged}" />
                </hc:ElementGroup>
                <hc:ElementGroup
                    Height="30"
                    VerticalAlignment="Center"
                    Layout="Stack">
                    <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                        <TextBlock
                            Width="50"
                            VerticalAlignment="Center"
                            Text="属性名称" />
                    </Border>
                    <hc:AutoCompleteTextBox
                        MinWidth="150"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        ItemsSource="{Binding NameItems}"
                        Text="{Binding EquipmentPropName}" />
                </hc:ElementGroup>
                <hc:ElementGroup
                    Height="30"
                    VerticalAlignment="Center"
                    Layout="Stack">
                    <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                        <TextBlock
                            Width="50"
                            VerticalAlignment="Center"
                            Text="属性类型" />
                    </Border>
                    <hc:ComboBox
                        MinWidth="150"
                        MaxWidth="200"
                        DisplayMemberPath="Key"
                        ItemsSource="{Binding EquipmentPropTypes}"
                        SelectedValue="{Binding EquipmentPropType}"
                        SelectedValuePath="Value"
                        Style="{StaticResource ComboBoxExtend}" />
                </hc:ElementGroup>
            </hc:UniformSpacingPanel>
            <ToolBar
                Margin="0,1"
                Padding="4"
                HorizontalAlignment="Right">
                <hc:UniformSpacingPanel Spacing="5">
                    <Button
                        hc:IconElement.Geometry="{StaticResource SearchGeometry}"
                        Command="{Binding SerachCommand}"
                        Content="搜索"
                        Style="{StaticResource ButtonDefault}" />
                </hc:UniformSpacingPanel>
            </ToolBar>
        </StackPanel>
        <hc:Pagination
            DataCountPerPage="{Binding PageSize}"
            DockPanel.Dock="Bottom"
            IsJumpEnabled="True"
            MaxPageCount="{Binding MaxPage}"
            PageIndex="{Binding PageIndex}">
            <hc:Interaction.Triggers>
                <hc:EventTrigger EventName="PageUpdated">
                    <hc:EventToCommand Command="{Binding PageUpdatedCommand}" PassEventArgsToCommand="True" />
                </hc:EventTrigger>
            </hc:Interaction.Triggers>
        </hc:Pagination>
        <DataGrid
            hc:DataGridAttach.CanUnselectAllWithBlankArea="True"
            hc:DataGridAttach.ShowRowNumber="True"
            AutoGenerateColumns="False"
            HeadersVisibility="All"
            IsReadOnly="True"
            ItemsSource="{Binding EquipmentPropList}"
            RowHeaderWidth="60"
            Style="{StaticResource DataGrid.Small}">
            <!--<DataGrid.RowHeaderTemplate>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}"/>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>-->
            <DataGrid.Columns>
                <DataGridTextColumn
                    Binding="{Binding Id}"
                    Header="Id"
                    Visibility="Hidden" />
                <DataGridTextColumn Binding="{Binding EquipmentTypePropTemplateCode}" Header="属性编号" />
                <DataGridTextColumn Binding="{Binding EquipmentTypePropTemplate.Name}" Header="属性名称" />
                <DataGridTextColumn Binding="{Binding EquipmentTypePropTemplate.DataType}" Header="数据类型" />
                <DataGridTextColumn Binding="{Binding Address}" Header="地址" />
                <DataGridTextColumn Binding="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Header="值" />
                <DataGridTextColumn Binding="{Binding EquipmentTypePropTemplate.PropType}" Header="属性类型" />
                <DataGridTextColumn Binding="{Binding EquipmentTypePropTemplate.Description}" Header="描述" />
                <DataGridTextColumn Binding="{Binding Created, StringFormat={}{0:yyyy/MM/dd HH:mm:ss}}" Header="创建时间" />
                <DataGridTextColumn Binding="{Binding Updated, UpdateSourceTrigger=PropertyChanged, StringFormat={}{0:yyyy/MM/dd HH:mm:ss}}" Header="修改时间" />
            </DataGrid.Columns>
        </DataGrid>
    </DockPanel>
</Window>