添加项目文件。
This commit is contained in:
192
QuickModeling/Views/ConfigurationPropsAttachView.xaml
Normal file
192
QuickModeling/Views/ConfigurationPropsAttachView.xaml
Normal file
@@ -0,0 +1,192 @@
|
||||
<Window x:Class="QuickModeling.Views.ConfigurationPropsAttachView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="clr-namespace:QuickModeling.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:QuickModeling.Models"
|
||||
xmlns:markup="clr-namespace:QuickModeling.Markup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="clr-namespace:QuickModeling.ViewModels"
|
||||
Width="320"
|
||||
Height="400"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=views:ConfigurationPropsAttachViewModel}"
|
||||
Title="参数批处理"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Window.Resources>
|
||||
<conv:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
|
||||
<!-- <Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander Header="{Binding Name}" IsExpanded="True">
|
||||
--> <!-- <Expander.Header>
|
||||
<TextBlock Text="{Binding Path=Name}"/>
|
||||
</Expander.Header> --> <!-- <ItemsPresenter />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style> -->
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Margin" Value="4" />
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="Margin" Value="4" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Margin" Value="4" />
|
||||
<Setter Property="Padding" Value="3" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<!-- <Expander Header="{Binding Name}" IsExpanded="True">
|
||||
--> <!-- <Expander.Header>
|
||||
<TextBlock Text="{Binding Path=Name}"/>
|
||||
</Expander.Header> --> <!-- <ItemsPresenter />
|
||||
</Expander> -->
|
||||
<Expander IsExpanded="True">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock FontWeight="Bold" Text="参数分组:" />
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Name}" />
|
||||
<TextBlock Text="{Binding ItemCount, StringFormat=' (合计数量 = \{0} )'}" />
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
<ItemsPresenter />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
Text="构件类型:" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Margin="5"
|
||||
ItemsSource="{markup:EnumSource EnumType=local:ComponentType, BindToDescription=True}"
|
||||
SelectedValue="{Binding SelectedComponentType}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
Text="参数模板:" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Margin="5"
|
||||
DisplayMemberPath="Name"
|
||||
ItemsSource="{Binding Configs}"
|
||||
SelectedItem="{Binding SelectedConfig}" />
|
||||
</Grid>
|
||||
<GroupBox Grid.Row="3"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="5"
|
||||
Header="参数列表">
|
||||
<DataGrid AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||
ItemsSource="{Binding SelectedConfig.Parameters}"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.IsVirtualizingWhenGrouping="True">
|
||||
<DataGrid.RowValidationErrorTemplate>
|
||||
<ControlTemplate>
|
||||
<Grid ToolTip="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}, Path=(Validation.Errors).CurrentItem.ErrorContent}">
|
||||
<!-- <Ellipse Width="{TemplateBinding FontSize}"
|
||||
Height="{TemplateBinding FontSize}"
|
||||
Fill="Red"
|
||||
StrokeThickness="0" /> -->
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="Bold"
|
||||
Foreground="Red"
|
||||
Text="!" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</DataGrid.RowValidationErrorTemplate>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridCell">
|
||||
<Grid Background="{TemplateBinding Background}">
|
||||
<ContentPresenter VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<!-- 确保 TextBlock 也垂直居中(如果列内容是 TextBlock) -->
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
|
||||
<GroupStyle.Panel>
|
||||
<ItemsPanelTemplate>
|
||||
<DataGridRowsPresenter />
|
||||
</ItemsPanelTemplate>
|
||||
</GroupStyle.Panel>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="2*"
|
||||
Binding="{Binding Name}"
|
||||
Header="名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Width="*"
|
||||
Binding="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
|
||||
Header="值" />
|
||||
<DataGridTextColumn Width="Auto"
|
||||
Binding="{Binding DataType, Converter={StaticResource EnumToDescriptionConverter}}"
|
||||
Header="单位"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</GroupBox>
|
||||
<UniformGrid Grid.Row="4"
|
||||
Grid.ColumnSpan="3"
|
||||
Rows="1">
|
||||
<Button Margin="5"
|
||||
Command="{Binding ConfigManagerCommand}"
|
||||
Content="配置管理" />
|
||||
<Button Margin="5"
|
||||
Command="{Binding ModifyConfigCommand}"
|
||||
CommandParameter="{Binding SelectedConfig}"
|
||||
Content="修改当前模板" />
|
||||
<Button Margin="5"
|
||||
Command="{Binding AddToModelsCommand}"
|
||||
CommandParameter="{Binding SelectedConfig}"
|
||||
Content="添加到选中模型" />
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user