You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
16 KiB

<UserControl x:Class="SchedulingSystemClient.SBGLWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="UserControl_Loaded">
<UserControl.Resources>
<ControlTemplate x:Key="ExampleButton" TargetType="{x:Type Button}">
<Border Background="White" BorderThickness="0" x:Name="Border" Padding="10" Margin="5,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="BorderThickness" Value="0,0,0,2"/>
<Setter TargetName="Border" Property="BorderBrush" Value="#315DDA"/>
<Setter TargetName="Border" Property="TextBlock.Foreground" Value="#315DDA"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="header" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="Foreground" Value="#484848"></Setter>
<Setter Property="Background" Value="#E8E8E8"></Setter>
<Setter Property="BorderBrush" Value="#DDDDDD"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="FontSize" Value="20"></Setter>
<!--<Setter Property="Height" Value="40"></Setter>-->
<Setter Property="Padding" Value="15,10"></Setter>
</Style>
<Style x:Key="cell" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="Padding" Value="15"></Setter>
<Setter Property="Foreground" Value="#484848"></Setter>
<Setter Property="FontSize" Value="16"></Setter>
</Style>
<Style x:Key="row" TargetType= "{x:Type DataGridRow}">
<Setter Property="BorderBrush" Value="#ECEEF4"></Setter>
<Style.Triggers>
<!--单行颜色-->
<Trigger Property= "ItemsControl.AlternationIndex"
Value= "0" >
<Setter Property= "Background" Value= "#FFFFFF"/>
</Trigger>
<!--双行颜色-->
<Trigger Property= "ItemsControl.AlternationIndex"
Value= "1" >
<Setter Property= "Background" Value= "#FFFFFF"/>
</Trigger>
<!--鼠标移入行颜色-->
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#EDF0FA"/>
</Trigger>
</Style.Triggers>
</Style>
<!--选中行颜色-->
<Style x:Key="dgc" TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="#ECEEF4"></Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#EDF0FA"/>
<Setter Property="BorderBrush" Value="#0000"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="Dgrid" TargetType="DataGrid">
<!--内容边框颜色-->
<Setter Property="HorizontalGridLinesBrush" Value="#ECEEF4"></Setter>
<Setter Property="VerticalGridLinesBrush" Value="#ECEEF4"></Setter>
<!--获取或设置一个值,该值指示是否自动创建列-->
<Setter Property="AutoGenerateColumns" Value="False"/>
<!--获取或设置一个值,该值指示用户是否可使用鼠标调整列宽-->
<Setter Property="CanUserResizeColumns" Value="False"/>
<!--获取或设置一个值,该值指示用户能否通过用鼠标拖动列标题来更改列的显示顺序-->
<Setter Property="CanUserReorderColumns" Value="False"/>
<!--获取或设置一个值,该值指示用户是否可在 DataGrid 中添加新行-->
<Setter Property="CanUserAddRows" Value="False"/>
<!--获取或设置一个值,该值指示用户是否可从 DataGrid 中删除行-->
<Setter Property="CanUserDeleteRows" Value="False"/>
<Setter Property="IsReadOnly" Value="True"/>
<!--列表前面空白列-->
<Setter Property="RowHeaderWidth" Value="0"/>
</Style>
<!--下拉框-->
<ControlTemplate x:Key="CusComboBox" TargetType="{x:Type ComboBox}" >
<Border BorderThickness="2" BorderBrush="#E4E4E4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--文本框-->
<TextBox x:Name="myTxt" Grid.Column="0"
Text="{TemplateBinding Text}"
Background="White"
BorderThickness="0"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
FontSize="18"
Foreground="Black"/>
<!--下拉按钮-->
<ToggleButton Grid.Column="1" Content="∨" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press" Background="White" BorderThickness="0"/>
<Popup Name="MyPopup"
IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom">
<Border MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<StackPanel Background="White"
IsItemsHost="True"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
<!--占位符-->
<Style x:Key="placeHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<TextBox Padding="0,0,0,0" VerticalContentAlignment="Center" Text="{Binding Path=Text,
RelativeSource={RelativeSource TemplatedParent},
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
x:Name="textSource"
Background="Transparent"
Panel.ZIndex="2" />
<TextBox Padding="0,0,0,0" VerticalContentAlignment="Center" Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="Transparent"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
<Setter Property="Foreground" Value="#aaaaaa"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="14*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#DDDDDD" BorderThickness="2" Margin="10,5" >
<DockPanel LastChildFill="False" Background="White">
<Label Height="40" Margin="10,0,0,0" VerticalContentAlignment="Center" FontSize="18" HorizontalAlignment="Center" Foreground="Black">设备名称:</Label>
<TextBox x:Name="sbmc" Width="200" Height="35" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center" Style="{StaticResource placeHolder}" ></TextBox>
<Label Height="40" Margin="10,0,0,0" VerticalContentAlignment="Center" FontSize="18" HorizontalAlignment="Center" Foreground="Black">设备类型:</Label>
<ComboBox x:Name="sblx" Height="35" Width="150" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Background="White" Template="{StaticResource CusComboBox}"></ComboBox>
<Label Height="40" Margin="10,0,0,0" VerticalContentAlignment="Center" FontSize="18" HorizontalAlignment="Center" Foreground="Black">手术室:</Label>
<ComboBox x:Name="sss" Height="35" Width="150" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Background="White" Template="{StaticResource CusComboBox}"></ComboBox>
<Label Height="40" Margin="10,0,0,0" VerticalContentAlignment="Center" FontSize="18" HorizontalAlignment="Center" Foreground="Black">设备等级:</Label>
<ComboBox x:Name="sbdj" Height="35" Width="140" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Background="White" Template="{StaticResource CusComboBox}"></ComboBox>
<Button x:Name="btn_sc" FontSize="18" Height="35" Width="60" DockPanel.Dock="Right" Margin="0,0,10,0" Click="btn_sc_Click" Content="删 除" Background="#D4495C" Foreground="White" VerticalContentAlignment="Center">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="3,3,3,3">
<Border.Background>#D4495C</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button x:Name="btn_xg" FontSize="18" Height="35" Width="60" DockPanel.Dock="Right" Margin="0,0,10,0" Click="btn_xg_Click" Content="修 改" Background="#558BE3" Foreground="White" VerticalContentAlignment="Center">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="3,3,3,3">
<Border.Background>#558BE3</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button x:Name="btn_tj" FontSize="18" Height="35" Width="60" DockPanel.Dock="Right" Margin="0,0,10,0" Click="btn_tj_Click" Content="添 加" Background="#558BE3" Foreground="White" VerticalContentAlignment="Center">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="3,3,3,3">
<Border.Background>#558BE3</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<Button x:Name="btn_sx" FontSize="18" Height="35" Width="60" DockPanel.Dock="Right" Margin="0,0,10,0" Click="btn_sx_Click" Content="查询" Background="#558BE3" Foreground="White" VerticalContentAlignment="Center">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="3,3,3,3">
<Border.Background>#558BE3</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</DockPanel>
</Border>
<Border Grid.Row="1" BorderBrush="#DDDDDD" BorderThickness="2" Margin="10,5" Padding="10">
<Grid>
<DataGrid x:Name="sbgldata" Grid.Row="1" CanUserAddRows="False" AutoGenerateColumns="False" FontSize="20" SelectionChanged="sbgldata_SelectionChanged"
Style="{StaticResource Dgrid}" RowStyle="{StaticResource row}" CellStyle="{StaticResource dgc}" Background="White">
<DataGrid.Columns>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备编码" Binding="{Binding SBBM}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备名称" Binding="{Binding SBMC}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备类型" Binding="{Binding strSBLX}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="所属手术室" Binding="{Binding SSSMC}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备价格" Binding="{Binding SBJG}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备等级" Binding="{Binding strSBDJ}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="ID" Visibility="Collapsed" Binding="{Binding ID}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="手术室ID" Visibility="Collapsed" Binding="{Binding SSSID}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备类型ID" Visibility="Collapsed" Binding="{Binding SBLX}"/>
<DataGridTextColumn HeaderStyle="{StaticResource header}" ElementStyle="{StaticResource cell}" Header="设备等级ID" Visibility="Collapsed" Binding="{Binding SBDJ}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</UserControl>