242 lines
12 KiB
XML
242 lines
12 KiB
XML
<UserControl
|
|
x:Class="SWS.Electrical.Views.DialogGenerateBOM"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:Custom="http://www.galasoft.ch/mvvmlight"
|
|
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:local="clr-namespace:SWS.Electrical"
|
|
xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:prism="http://prismlibrary.com/"
|
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
|
Width="900"
|
|
Height="700"
|
|
Background="#2D3135"
|
|
mc:Ignorable="d">
|
|
<prism:Dialog.WindowStyle>
|
|
<Style TargetType="Window">
|
|
<Setter Property="Width" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}" />
|
|
<Setter Property="Height" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}" />
|
|
|
|
<Setter Property="WindowState" Value="Normal" />
|
|
<Setter Property="WindowStyle" Value="None" />
|
|
<Setter Property="ResizeMode" Value="NoResize" />
|
|
</Style>
|
|
</prism:Dialog.WindowStyle>
|
|
<UserControl.Resources>
|
|
<ResourceDictionary>
|
|
<Style TargetType="DataGrid">
|
|
<Setter Property="RowHeaderWidth" Value="0" />
|
|
<Setter Property="AutoGenerateColumns" Value="False" />
|
|
<Setter Property="CanUserAddRows" Value="False" />
|
|
<Setter Property="CanUserResizeColumns" Value="False" />
|
|
<Setter Property="CanUserResizeRows" Value="False" />
|
|
<Setter Property="HorizontalGridLinesBrush" Value="LightGray" />
|
|
<Setter Property="VerticalGridLinesBrush" Value="LightGray" />
|
|
<Setter Property="IsReadOnly" Value="False" />
|
|
<Setter Property="BorderThickness" Value="1,0" />
|
|
<Setter Property="BorderBrush" Value="LightGray" />
|
|
<Setter Property="RowHeight" Value="30" />
|
|
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
|
</Style>
|
|
|
|
<!-- DataGrid表头样式 -->
|
|
<Style TargetType="DataGridColumnHeader">
|
|
<Setter Property="FontSize" Value="13" />
|
|
<Setter Property="Background" Value="White" />
|
|
<Setter Property="BorderThickness" Value="1,1,1,1" />
|
|
<Setter Property="BorderBrush" Value="LightGray" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<!-- DataGrid复选框样式 -->
|
|
<Style x:Key="VerticalCheckBox" TargetType="CheckBox">
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="FontSize" Value="16" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type CheckBox}">
|
|
<StackPanel Name="sp" HorizontalAlignment="Center">
|
|
<ContentPresenter Margin="2" HorizontalAlignment="Center" />
|
|
<Border
|
|
x:Name="bd"
|
|
Width="20"
|
|
Height="20"
|
|
BorderBrush="Gray"
|
|
BorderThickness="1.5">
|
|
<Border.Background>
|
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
|
<GradientStop Offset="0.05" Color="LightGray" />
|
|
<GradientStop Offset="1" Color="White" />
|
|
</LinearGradientBrush>
|
|
</Border.Background>
|
|
<Path
|
|
Name="checkPath"
|
|
Width="18"
|
|
Height="16"
|
|
Stroke="Black"
|
|
StrokeThickness="2" />
|
|
</Border>
|
|
</StackPanel>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="checkPath" Property="Data" Value="M 1.5,5 L 7,13 17,0" />
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="bd" Property="Background" Value="LightGray" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- DataGrid单元格选中样式 #6495ED -->
|
|
<Style TargetType="DataGridCell">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Foreground" Value="#6495ED" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
|
|
</ResourceDictionary>
|
|
</UserControl.Resources>
|
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
|
<Grid>
|
|
<Grid.Resources>
|
|
<HierarchicalDataTemplate
|
|
x:Key="MyTreeItemTemplate"
|
|
DataType="{x:Type local2:TreeModel}"
|
|
ItemsSource="{Binding ChildNodes}">
|
|
<StackPanel
|
|
x:Name="My_SP"
|
|
Margin="2"
|
|
Orientation="Horizontal">
|
|
<CheckBox IsChecked="{Binding IsChecked}" />
|
|
<ContentPresenter Margin="2,0" Content="{Binding Text}" />
|
|
</StackPanel>
|
|
</HierarchicalDataTemplate>
|
|
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
|
|
<Setter Property="IsExpanded" Value="False" />
|
|
</Style>
|
|
</Grid.Resources>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto" />
|
|
<RowDefinition Height="70" />
|
|
<RowDefinition Height="300" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="0.4*" />
|
|
<ColumnDefinition Width="0.6*" />
|
|
</Grid.ColumnDefinitions>
|
|
<CustomControl:customWindowTitleBar
|
|
x:Name="titleBar"
|
|
Grid.Row="0"
|
|
Grid.ColumnSpan="2" />
|
|
|
|
<TreeView
|
|
x:Name="dwgTree"
|
|
Grid.Row="1"
|
|
Grid.RowSpan="3"
|
|
Grid.Column="0"
|
|
Height="auto"
|
|
FontSize="14"
|
|
ItemContainerStyle="{StaticResource TreeViewItemStyle}"
|
|
ItemsSource="{Binding listDrawings, Mode=TwoWay}">
|
|
<TreeView.ItemTemplate>
|
|
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
|
<StackPanel Orientation="Horizontal">
|
|
<CheckBox
|
|
HorizontalAlignment="Center"
|
|
Focusable="False"
|
|
IsChecked="{Binding Path=IsChecked}"
|
|
IsTabStop="False"
|
|
Tag="{Binding Path=ID}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="Click">
|
|
<i:InvokeCommandAction Command="{Binding DataContext.Command_ChangeCheck, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=CheckBox}}" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</CheckBox>
|
|
<TextBlock HorizontalAlignment="Center" Text="{Binding Path=Text}" />
|
|
</StackPanel>
|
|
</HierarchicalDataTemplate>
|
|
</TreeView.ItemTemplate>
|
|
</TreeView>
|
|
|
|
<StackPanel
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
Height="30"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Center"
|
|
Orientation="Horizontal">
|
|
<Button
|
|
Width="140"
|
|
Margin="60,0,0,0"
|
|
HorizontalAlignment="Center"
|
|
Command="{Binding Command_StartGenerate}"
|
|
Content="生成材料表"
|
|
FontSize="16" />
|
|
</StackPanel>
|
|
<DataGrid
|
|
x:Name="dgTag"
|
|
Grid.Row="2"
|
|
Grid.Column="1"
|
|
Height="auto"
|
|
AutoGenerateColumns="False"
|
|
CanUserAddRows="False"
|
|
CanUserResizeColumns="True"
|
|
HeadersVisibility="Column"
|
|
ItemsSource="{Binding listBomDrawings, Mode=TwoWay}"
|
|
RowHeight="22"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
SelectionMode="Single">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn
|
|
Width="0.65*"
|
|
Binding="{Binding DrawingFileName}"
|
|
Header="图纸"
|
|
IsReadOnly="True" />
|
|
|
|
<DataGridTextColumn
|
|
Width="0.35*"
|
|
Binding="{Binding AutoGenerate}"
|
|
Header="生成材料表"
|
|
IsReadOnly="True" />
|
|
</DataGrid.Columns>
|
|
<DataGrid.RowStyle>
|
|
<Style TargetType="DataGridRow">
|
|
<Setter Property="Background" Value="White" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding AutoGenerate}" Value="已生成">
|
|
<Setter Property="Background" Value="LightGreen" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding AutoGenerate}" Value="已存在">
|
|
<Setter Property="Background" Value="LightYellow" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</DataGrid.RowStyle>
|
|
</DataGrid>
|
|
<ListBox
|
|
Grid.Row="3"
|
|
Grid.Column="1"
|
|
Background="Black"
|
|
ItemsSource="{Binding listMsg}"
|
|
ScrollViewer.VerticalScrollBarVisibility="Visible">
|
|
<i:Interaction.Behaviors>
|
|
<local:ListBoxScrollToBottomBehavior />
|
|
</i:Interaction.Behaviors>
|
|
</ListBox>
|
|
</Grid>
|
|
</telerik:RadBusyIndicator>
|
|
</UserControl>
|