<pu:WindowX x:Class="HMI.AlarmInfoManage.AlarmSettingList"
|
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:HMI.AlarmInfoManage"
|
xmlns:pw="https://opensource.panuon.com/wpf"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:ui="clr-namespace:HMI.UI;assembly=HMI.UI"
|
xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
|
mc:Ignorable="d"
|
Title="{Binding SelectedValue,Mode=OneWay}"
|
SizeToContent="Height"
|
Width="800"
|
Height="600"
|
BorderBrush="#3E3E45"
|
BorderThickness="1"
|
Foreground="Black"
|
pu:WindowXCaption.Background="{StaticResource PrimaryColor}"
|
pu:WindowXModalDialog.ButtonStyle="{StaticResource ModalButton}"
|
pu:WindowXCaption.Foreground="#FFF"
|
pu:WindowXModalDialog.Buttons="OK"
|
pu:WindowXModalDialog.OKButtonContent="关闭"
|
Loaded="WindowX_Loaded"
|
WindowStartupLocation="CenterScreen"
|
pu:WindowXModalDialog.ButtonPanelMargin="0,30,10,10">
|
<Window.Resources>
|
<ResourceDictionary>
|
<ResourceDictionary.MergedDictionaries>
|
<pu:StyleDictionary Includes="TabControl"/>
|
<ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
|
<ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
|
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary>
|
</Window.Resources>
|
|
<Grid Margin="10">
|
<Border BorderThickness="1" BorderBrush="Gray">
|
<Grid>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition />
|
</Grid.RowDefinitions>
|
|
<ListBox ItemsSource="{Binding Items}" SelectedValue="{Binding SelectedValue}" BorderThickness="0">
|
<ListBox.ItemsPanel>
|
<ItemsPanelTemplate>
|
<StackPanel Orientation="Horizontal"/>
|
</ItemsPanelTemplate>
|
</ListBox.ItemsPanel>
|
<ListBox.ItemContainerStyle>
|
<Style TargetType="ListBoxItem">
|
<Setter Property="Margin" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="ListBoxItem">
|
<Border x:Name="border" Background="LightGray"
|
Padding="10" Margin="0" BorderThickness="0">
|
<!-- 内容呈现器 -->
|
<StackPanel>
|
<ContentPresenter Content="{TemplateBinding Content}"
|
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
</StackPanel>
|
</Border>
|
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter TargetName="border" Property="Background" Value="White"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</ListBox.ItemContainerStyle>
|
</ListBox>
|
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"
|
Margin="0,0,0,10"
|
dp:StackPanelHelper.ChildSpace="10">
|
<Button Style="{StaticResource PrimaryButton}" pu:ButtonHelper.Icon="" x:Name="refreshBtn" Click="Button_Click">刷新</Button>
|
<Button Style="{StaticResource PrimaryButton}" pu:ButtonHelper.Icon="" x:Name="addBtn" Click="Button_Click">新增</Button>
|
<Button Style="{StaticResource DangerButton}" pu:ButtonHelper.Icon="" x:Name="delBatchBtn" Click="Button_Click">删除</Button>
|
</StackPanel>
|
|
<DataGrid x:Name="table" Grid.Row="2"
|
Style="{StaticResource DefaultDataGrid}" ItemsSource="{Binding Datasource}">
|
<DataGrid.Columns>
|
<DataGridTemplateColumn Header="" Width="Auto" CanUserResize="False">
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<CheckBox VerticalAlignment="Center"
|
IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn>
|
<DataGridTemplateColumn Header="#" CanUserResize="False">
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<TextBlock Text="{Binding Converter={StaticResource rowNumber},
|
RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn>
|
<DataGridTextColumn Width="*" Binding="{Binding DBAddress}" Header="DB地址" />
|
<DataGridTextColumn Width="*" Binding="{Binding StartAddress}" Header="起始地址" />
|
<DataGridTextColumn Width="*" Binding="{Binding Length}" Header="DB长度" />
|
<DataGridTemplateColumn Header="操作" Width="100" IsReadOnly="True" CanUserResize="False">
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<StackPanel Orientation="Horizontal">
|
<Button x:Name="editBtn" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"
|
Style="{StaticResource RowLink}"
|
Margin="0,0,10,0"
|
Click="Button_Click"
|
DataContext="{Binding }">编辑</Button>
|
<Button x:Name="delBtn" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"
|
Style="{StaticResource DangerLinkButton}"
|
DataContext="{Binding }"
|
Click="Button_Click">删除</Button>
|
</StackPanel>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn>
|
</DataGrid.Columns>
|
</DataGrid>
|
</Grid>
|
</Border>
|
</Grid>
|
</pu:WindowX>
|