269 lines
14 KiB
XML
269 lines
14 KiB
XML
<ui:FluentWindowEx
|
|
Height="600"
|
|
Title="重命名族"
|
|
Width="900"
|
|
d:DataContext="{d:DesignInstance local:RenameFamilyViewModel}"
|
|
mc:Ignorable="d"
|
|
x:Class="ShrlAlgo.RvKits.RvFamily.RenameFamilyView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:ShrlAlgo.RvKits.RvFamily"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:ui="https://github.com/ShrlAlgo/WPFluent"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:attach="clr-namespace:ShrlAlgoToolkit.Mvvm.Attach;assembly=ShrlAlgoToolkit.Mvvm"
|
|
xmlns:validationRules="clr-namespace:ShrlAlgoToolkit.Mvvm.ValidationRules;assembly=ShrlAlgoToolkit.Mvvm">
|
|
<Window.Resources>
|
|
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
|
|
</Window.Resources>
|
|
<ui:AutoGrid
|
|
ChildMargin="5"
|
|
Columns="250,*,*,*"
|
|
Rows="*,Auto">
|
|
<ui:AutoGrid
|
|
Columns="*"
|
|
Grid.RowSpan="2"
|
|
Rows="*,Auto,Auto">
|
|
<GroupBox Header="族类别">
|
|
<ListBox
|
|
DisplayMemberPath="Key"
|
|
Height="400"
|
|
ItemsSource="{Binding Collection, Mode=OneWay}"
|
|
SelectionMode="Multiple"
|
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
|
x:Name="LbCategories">
|
|
<!--<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>-->
|
|
<!--<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>-->
|
|
<!--<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border CornerRadius="5" />
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>-->
|
|
<!--<ListBox.ItemContainerStyle>
|
|
<Style />
|
|
</ListBox.ItemContainerStyle>-->
|
|
<b:Interaction.Triggers>
|
|
<b:EventTrigger EventName="SelectionChanged">
|
|
<b:InvokeCommandAction Command="{Binding GetRenameItemsCommand}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />
|
|
</b:EventTrigger>
|
|
</b:Interaction.Triggers>
|
|
<!--<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal">
|
|
<CheckBox IsChecked="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" />
|
|
<TextBlock VerticalAlignment="Center" Text="{Binding Value}" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>-->
|
|
</ListBox>
|
|
</GroupBox>
|
|
<DockPanel>
|
|
<CheckBox Content="全选">
|
|
<b:Interaction.Triggers>
|
|
<b:EventTrigger EventName="Checked">
|
|
<b:CallMethodAction MethodName="SelectAll" TargetObject="{Binding ElementName=LbCategories}" />
|
|
</b:EventTrigger>
|
|
<b:EventTrigger EventName="Unchecked">
|
|
<b:CallMethodAction MethodName="UnselectAll" TargetObject="{Binding ElementName=LbCategories}" />
|
|
</b:EventTrigger>
|
|
</b:Interaction.Triggers>
|
|
</CheckBox>
|
|
<TextBlock
|
|
HorizontalAlignment="Right"
|
|
Text="{Binding CategoryCount, StringFormat=类别数:{}{0:D}}"
|
|
VerticalAlignment="Center" />
|
|
</DockPanel>
|
|
<ui:TextBoxEx PlaceholderText="过滤族类别" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" />
|
|
</ui:AutoGrid>
|
|
<DataGrid
|
|
AutoGenerateColumns="False"
|
|
CanUserAddRows="False"
|
|
Grid.Column="1"
|
|
Grid.ColumnSpan="3"
|
|
Grid.Row="0"
|
|
HeadersVisibility="Column"
|
|
IsEnabled="{Binding CanInput}"
|
|
ItemsSource="{Binding RenameItems}"
|
|
SelectionUnit="Cell"
|
|
attach:TextSearch.SearchValue="{Binding Text, ElementName=TbFound, UpdateSourceTrigger=PropertyChanged}"
|
|
x:Name="DgRename">
|
|
<DataGrid.Resources>
|
|
<Style BasedOn="{StaticResource DefaultDataGridCellStyle}" TargetType="{x:Type DataGridCell}">
|
|
<!--<Setter Property="HorizontalAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />-->
|
|
<Setter Property="attach:TextSearch.IsTextMatch">
|
|
<Setter.Value>
|
|
<MultiBinding Converter="{StaticResource SearchFamilyValueConverter}">
|
|
<Binding Path="Content.Text" RelativeSource="{RelativeSource Mode=Self}" />
|
|
<Binding Path="(attach:TextSearch.SearchValue)" RelativeSource="{RelativeSource Mode=Self}" />
|
|
<Binding RelativeSource="{RelativeSource Mode=Self}" />
|
|
</MultiBinding>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="attach:TextSearch.IsTextMatch" Value="True">
|
|
<Setter Property="Foreground" Value="SkyBlue" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</DataGrid.Resources>
|
|
<DataGrid.ColumnHeaderStyle>
|
|
<Style BasedOn="{StaticResource DefaultDataGridColumnHeaderStyle}" TargetType="{x:Type DataGridColumnHeader}">
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
</DataGrid.ColumnHeaderStyle>
|
|
<DataGrid.Columns>
|
|
<DataGridCheckBoxColumn
|
|
Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}"
|
|
EditingElementStyle="{StaticResource DataGridCheckBoxEditingElementDefaultStyle}"
|
|
ElementStyle="{StaticResource DataGridCheckBoxElementDefaultStyle}"
|
|
MinWidth="80">
|
|
<DataGridCheckBoxColumn.Header>
|
|
<Border Background="Transparent">
|
|
<CheckBox
|
|
Content="全选"
|
|
HorizontalAlignment="Center"
|
|
IsChecked="{Binding DataContext.IsAllItemsSelected, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
|
</Border>
|
|
</DataGridCheckBoxColumn.Header>
|
|
<!--<DataGridCheckBoxColumn.HeaderStyle>
|
|
<Style BasedOn="{StaticResource DefaultDataGridColumnHeaderStyle}" TargetType="{x:Type DataGridColumnHeader}">
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
</DataGridCheckBoxColumn.HeaderStyle>-->
|
|
</DataGridCheckBoxColumn>
|
|
<DataGridTextColumn
|
|
Binding="{Binding CategoryName}"
|
|
Header="族类别"
|
|
IsReadOnly="True"
|
|
MinWidth="80">
|
|
<DataGridTextColumn.ElementStyle>
|
|
<Style TargetType="{x:Type TextBlock}">
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
</DataGridTextColumn.ElementStyle>
|
|
</DataGridTextColumn>
|
|
<DataGridTextColumn
|
|
Binding="{Binding OldFamilyName}"
|
|
Header="族名称"
|
|
IsReadOnly="True"
|
|
MinWidth="80">
|
|
<DataGridTextColumn.ElementStyle>
|
|
<Style TargetType="{x:Type TextBlock}">
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
</DataGridTextColumn.ElementStyle>
|
|
</DataGridTextColumn>
|
|
<DataGridTextColumn
|
|
Binding="{Binding NewFamilyName, UpdateSourceTrigger=PropertyChanged}"
|
|
EditingElementStyle="{StaticResource DefaultTextBoxStyle}"
|
|
Header="新族名称"
|
|
MinWidth="80">
|
|
<DataGridTextColumn.ElementStyle>
|
|
<Style TargetType="{x:Type TextBlock}">
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
</DataGridTextColumn.ElementStyle>
|
|
</DataGridTextColumn>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
<GroupBox Header="前/后缀">
|
|
<UniformGrid Columns="1">
|
|
<ui:TextBox
|
|
IsEnabled="{Binding CanInput}"
|
|
Margin="5"
|
|
PlaceholderText="前缀"
|
|
x:Name="CbPrefix">
|
|
<Binding Path="PrefixText" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</ui:TextBox>
|
|
<!--<TextBox
|
|
x:Name="TbPrefix"
|
|
materialDesign:HintAssist.Hint="前缀"
|
|
IsEnabled="{Binding CanInput}">
|
|
<TextBox.Text>
|
|
<Binding Path="PrefixText" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</TextBox.Text>
|
|
</TextBox>-->
|
|
<ui:TextBox
|
|
IsEnabled="{Binding CanInput}"
|
|
Margin="5"
|
|
PlaceholderText="后缀"
|
|
x:Name="TbSuffix">
|
|
<Binding Path="SuffixText" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</ui:TextBox>
|
|
</UniformGrid>
|
|
</GroupBox>
|
|
<GroupBox Header="查找/替换">
|
|
<StackPanel>
|
|
<ui:TextBox
|
|
IsEnabled="{Binding CanInput}"
|
|
Margin="5"
|
|
PlaceholderText="查找"
|
|
x:Name="TbFound">
|
|
<Binding Path="FoundText" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</ui:TextBox>
|
|
<ui:TextBox
|
|
IsEnabled="{Binding CanInput}"
|
|
Margin="5"
|
|
PlaceholderText="替换"
|
|
x:Name="TbReplace">
|
|
<Binding Path="ReplaceText" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</ui:TextBox>
|
|
</StackPanel>
|
|
</GroupBox>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition />
|
|
<RowDefinition />
|
|
</Grid.RowDefinitions>
|
|
<GroupBox Grid.Row="0" Header="连接符">
|
|
<TextBox IsEnabled="{Binding CanInput}" x:Name="TbSeparator">
|
|
<Binding Path="Separator" UpdateSourceTrigger="PropertyChanged">
|
|
<Binding.ValidationRules>
|
|
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
|
</Binding.ValidationRules>
|
|
</Binding>
|
|
</TextBox>
|
|
</GroupBox>
|
|
<Button
|
|
Command="{Binding ModifyNameCommand}"
|
|
Content="修改名称"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Stretch"
|
|
ToolTip="勾选要修改的项进行修改" />
|
|
</Grid>
|
|
</ui:AutoGrid>
|
|
</ui:FluentWindowEx>
|