Files
RevitArchive/RevitKits/WBSCoder/ProjectCodeAddedCheckerPage.xaml
2026-02-23 14:58:05 +08:00

110 lines
5.0 KiB
XML

<Page
x:Class="Sai.Common.Shared.WBSCoder.ProjectCodeAddedCheckerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:attachedProp="clr-namespace:AttachedProp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Sai.Common.Shared.WBSCoder"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="ProjectCodeAddedCheckerPage"
d:DataContext="{d:DesignInstance Type=local:ProjectCodeAddedCheckerViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary Source="/Sai.RvKits;component/Styles/WPFUI.xaml" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DataGrid
x:Name="DataGridWbsCodeToAdd"
Grid.Row="0"
Grid.Column="0"
attachedProp:TextSearch.SearchValue="{Binding ElementName=TbSearch, Path=Text, UpdateSourceTrigger=PropertyChanged}"
d:ItemsSource="{d:SampleData}"
AutoGenerateColumns="False"
ItemsSource="{Binding LastTaskItems, Mode=TwoWay}">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="attachedProp:TextSearch.IsTextMatch">
<Setter.Value>
<MultiBinding Converter="{StaticResource SearchValueConverter}">
<Binding Path="DataContext.Name" RelativeSource="{RelativeSource Self}" />
<Binding Path="(attachedProp:TextSearch.SearchValue)"
RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="attachedProp:TextSearch.IsTextMatch" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridCheckBoxColumn
Binding="{Binding HasCoded}"
Header="编码"
IsReadOnly="True" />
<DataGridTextColumn
Binding="{Binding Parent}"
Header="上级任务"
IsReadOnly="True" />
<DataGridTextColumn
Binding="{Binding Name}"
Header="任务名"
IsReadOnly="True" />
<DataGridTextColumn
Binding="{Binding WBSCode}"
Header="WBS编码"
IsReadOnly="True" />
<DataGridTemplateColumn Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!-- 按钮参数绑定到当前行的绑定的Item -->
<Button
Command="{Binding DataContext.ParameterAdditionCmd, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding}"
Cursor="Hand"
ToolTip="添加到构件">
<materialDesign:PackIcon Kind="TagPlus" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="TbSearch"
Grid.Row="0"
Grid.Column="0"
materialDesign:HintAssist.Hint="搜索内容"
Cursor="Arrow" />
<Button
Grid.Column="1"
HorizontalAlignment="Right"
Command="{Binding CodeAddedCheckerCmd}"
Cursor="Hand"
ToolTip="校验编码">
<materialDesign:PackIcon Kind="TextBoxCheck" />
</Button>
<!--<Button
Width="75"
Height="30"
Margin="5"
HorizontalAlignment="Left"
Command="{Binding UpdateCodeDataCmd}"
Content="刷新" />-->
</Grid>
</Grid>
</Page>