Files
SzmediTools/Szmedi.Test/WriteParametersWin.xaml
2025-09-16 16:06:41 +08:00

126 lines
6.2 KiB
XML

<ui:FluentWindow
x:Class="Szmedi.Test.WriteParametersWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Szmedi.Test"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="实例参数编辑"
Width="500"
Height="420"
d:DataContext="{d:DesignInstance Type=local:WriteParametersViewModel}"
ExtendsContentIntoTitleBar="True"
FontFamily="Microsoft YaHei UI"
WindowBackdropType="Auto"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/Theme/Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/Wpf.Ui.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<DockPanel>
<ui:TitleBar Title="{Binding Title, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" DockPanel.Dock="Top" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DataGrid
Grid.Row="0"
Grid.Column="0"
d:ItemsSource="{d:SampleData}"
AutoGenerateColumns="False"
CanUserAddRows="False"
ItemsSource="{Binding Items}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="参数名" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Header="参数值" />
</DataGrid.Columns>
</DataGrid>
<UniformGrid
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Center"
Rows="1">
<CheckBox
MinWidth="5"
Margin="5"
HorizontalAlignment="Center"
Content="仅选中"
IsChecked="{Binding IsSelectedItems}"
ToolTip="选中元素修改,否则全部可见(临时隐藏也算不可见)元素修改" />
<CheckBox
MinWidth="5"
Margin="5"
HorizontalAlignment="Center"
Content="覆盖现值"
IsChecked="{Binding IsOverride}"
ToolTip="已有值会被表中填写值覆盖" />
<ListBox Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center">
<b:Interaction.Triggers>
<b:EventTrigger EventName="SelectionChanged">
<b:InvokeCommandAction Command="{Binding InitCommand}" CommandParameter="{Binding SelectedIndex, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" />
</b:EventTrigger>
</b:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem Content="土建" ToolTip="加载默认土建填写参数" />
<ListBoxItem Content="机电" ToolTip="加载默认机电填写参数" />
</ListBox>
</UniformGrid>
<UniformGrid Grid.Row="2" Grid.Column="0" Rows="1">
<ui:TextBox
Margin="5"
PlaceholderText="Excel文件路径"
Text="{Binding ExcelPath, UpdateSourceTrigger=PropertyChanged}"
ToolTip="输入路径回车读取文件">
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding OpenExcelCommand}" />
</TextBox.InputBindings>
<!--<b:Interaction.Triggers>
<b:EventTrigger EventName="LostFocus">
<b:InvokeCommandAction Command="{Binding OpenExcelCommand}" CommandParameter="{Binding Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TextBox}}" />
</b:EventTrigger>
</b:Interaction.Triggers>-->
</ui:TextBox>
<!--<TextBox md:HintAssist.Hint="忽略属性" Text="{Binding ExcelPath, UpdateSourceTrigger=PropertyChanged}" ToolTip="输入路径回车读取文件">
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding OpenExcelCommand}" />
</TextBox.InputBindings>
</TextBox>-->
<Button Margin="5" Command="{Binding BrowserExcelFileCommand}" Content="打开Excel文件" />
<Button Margin="5" Command="{Binding GetParamsCommand}" Content="从构件提取参数" />
</UniformGrid>
<UniformGrid
Grid.Row="3"
Grid.Column="0"
HorizontalAlignment="Center"
Rows="1">
<Button Margin="5" Command="{Binding ExportExcelCommand}" Content="导出Excel文件" />
<Button
Margin="5"
HorizontalAlignment="Center"
Command="{Binding WriteParamsCommand}"
Content="填写属性值"
ToolTip="深圳轨道交通标准的属性未填值会默认为“/”并且会跳过修改“ID-100-编号”" />
<Button
Margin="5"
HorizontalAlignment="Center"
Click="Button_Click"
Content="修改主题色" />
</UniformGrid>
</Grid>
</DockPanel>
</ui:FluentWindow>