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.
 
 
 

55 lines
3.4 KiB

<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.UserInformation"
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:SunlightCentralizedControlManagement_SCCM_"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d"
Closing="Window_Closing"
ResizeMode="NoResize"
WindowStyle="SingleBorderWindow"
Title="SUNLIGHT" Height="450" Width="800">
<Grid>
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
AutoGenerateColumns="False" MinColumnWidth="30" Background="White" GridLinesVisibility="All"
ColumnHeaderHeight="60" HorizontalContentAlignment="Right" CanUserReorderColumns="False"
CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserDeleteRows="False" SelectionMode="Single" FontSize="30" Focusable="True" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Style>
<DataTemplate x:Key="btnCell">
<!--注意此处的设置方式-->
<Button Content="{x:Static lang:Resources.Confirm}" Click="Button_Click" Tag="{Binding}" FontSize="20"/>
</DataTemplate>
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="200" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Code}" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding ID}" MaxWidth="0" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding Information}" Width="*" IsReadOnly="True"/>
<DataGridTemplateColumn Width="100" CellTemplate="{StaticResource btnCell}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>