315 lines
17 KiB
Plaintext
315 lines
17 KiB
Plaintext
|
|
<ex:FluentWindowEx
|
|||
|
|
x:Class="Sai.RvKits.RvFamily.FamilyLibrary.FamilyLibraryView"
|
|||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|||
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|||
|
|
xmlns:ex="https://github.com/sherlockforrest/Wpf.Ui.Extend"
|
|||
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|||
|
|
xmlns:local="clr-namespace:Sai.RvKits.RvFamily.FamilyLibrary"
|
|||
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|||
|
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|||
|
|
Title="本地族库"
|
|||
|
|
Width="1050"
|
|||
|
|
Height="600"
|
|||
|
|
MinWidth="1050"
|
|||
|
|
MinHeight="600"
|
|||
|
|
d:DataContext="{d:DesignInstance Type=local:FamilyLibraryViewModel}"
|
|||
|
|
ResizeMode="CanResizeWithGrip"
|
|||
|
|
mc:Ignorable="d">
|
|||
|
|
<Window.Resources>
|
|||
|
|
<ResourceDictionary>
|
|||
|
|
<ResourceDictionary.MergedDictionaries>
|
|||
|
|
<ResourceDictionary Source="pack://application:,,,/Sai.RvKits;component/WPFUI.xaml" />
|
|||
|
|
</ResourceDictionary.MergedDictionaries>
|
|||
|
|
</ResourceDictionary>
|
|||
|
|
</Window.Resources>
|
|||
|
|
<Grid>
|
|||
|
|
<Grid.RowDefinitions>
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
<RowDefinition Height="*" />
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
</Grid.RowDefinitions>
|
|||
|
|
<Grid.ColumnDefinitions>
|
|||
|
|
<ColumnDefinition Width="200" />
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<ColumnDefinition Width="*" />
|
|||
|
|
<ColumnDefinition Width="Auto" />
|
|||
|
|
<ColumnDefinition Width="220" />
|
|||
|
|
</Grid.ColumnDefinitions>
|
|||
|
|
<ui:Button
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Margin="5"
|
|||
|
|
HorizontalAlignment="Stretch"
|
|||
|
|
Command="{Binding SelectPathCommand}"
|
|||
|
|
Content="打开族目录"
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
Icon="{ui:FontIcon Glyph=,
|
|||
|
|
FontFamily={StaticResource BoxIcons}}"
|
|||
|
|
ToolTip="{Binding FamilyPath, Mode=OneWay, StringFormat=族目录:{}{0}}" />
|
|||
|
|
<TreeView
|
|||
|
|
x:Name="FolderTreeView"
|
|||
|
|
Grid.Row="1"
|
|||
|
|
d:ItemsSource="{d:SampleData}"
|
|||
|
|
ItemsSource="{Binding FolderTreeViewItems}">
|
|||
|
|
<i:Interaction.Triggers>
|
|||
|
|
<i:EventTrigger EventName="SelectedItemChanged">
|
|||
|
|
<i:InvokeCommandAction Command="{Binding SelectDirTreeNodeCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type TreeView}, Mode=FindAncestor}}" />
|
|||
|
|
<!--<behaviors:InvokeCommandAction Command="{Binding SetSelectedItem}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TreeView}}" />-->
|
|||
|
|
</i:EventTrigger>
|
|||
|
|
</i:Interaction.Triggers>
|
|||
|
|
</TreeView>
|
|||
|
|
<GridSplitter
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Width="1"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
ShowsPreview="True" />
|
|||
|
|
<ui:TextBox
|
|||
|
|
x:Name="SearchBox"
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
Margin="5"
|
|||
|
|
Cursor="IBeam"
|
|||
|
|
PlaceholderText="请输入搜索关键词">
|
|||
|
|
<i:Interaction.Triggers>
|
|||
|
|
<i:EventTrigger EventName="KeyDown">
|
|||
|
|
<i:InvokeCommandAction Command="{Binding SearchFamilyCommand}" CommandParameter="{Binding Text, RelativeSource={RelativeSource AncestorType={x:Type TextBox}, Mode=FindAncestor}}" />
|
|||
|
|
</i:EventTrigger>
|
|||
|
|
</i:Interaction.Triggers>
|
|||
|
|
</ui:TextBox>
|
|||
|
|
<ui:ListView
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.RowSpan="2"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
d:ItemsSource="{d:SampleData}"
|
|||
|
|
ItemsSource="{Binding FamilyPageListViewItems}"
|
|||
|
|
SelectedItem="{Binding SelectedFamily}">
|
|||
|
|
<i:Interaction.Triggers>
|
|||
|
|
<i:EventTrigger EventName="SelectionChanged">
|
|||
|
|
<i:InvokeCommandAction Command="{Binding LvSelectionChangedCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type ListView}, Mode=FindAncestor}}" />
|
|||
|
|
</i:EventTrigger>
|
|||
|
|
</i:Interaction.Triggers>
|
|||
|
|
<!--<ListView.View>
|
|||
|
|
<GridView>
|
|||
|
|
<GridViewColumn Header="缩略图" >
|
|||
|
|
<GridViewColumn.CellTemplate>
|
|||
|
|
<DataTemplate>
|
|||
|
|
<Image Source="{Binding ImageData}"/>
|
|||
|
|
</DataTemplate>
|
|||
|
|
</GridViewColumn.CellTemplate>
|
|||
|
|
</GridViewColumn>
|
|||
|
|
<GridViewColumn DisplayMemberBinding="{Binding Title}" Header="名称" />
|
|||
|
|
<GridViewColumn DisplayMemberBinding="{Binding Path}" Header="路径" />
|
|||
|
|
<GridViewColumn DisplayMemberBinding="{Binding RevitVersion}" Header="版本" />
|
|||
|
|
<GridViewColumn>
|
|||
|
|
<GridViewColumn.CellTemplate>
|
|||
|
|
<DataTemplate>
|
|||
|
|
<StackPanel Orientation="Horizontal">
|
|||
|
|
<Button
|
|||
|
|
Command="{Binding DataContext.ImportFamilyCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
|
|||
|
|
CommandParameter="{Binding}"
|
|||
|
|
Content="载入"
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
ToolTip="将族载入到当前项目" />
|
|||
|
|
<Button
|
|||
|
|
Command="{Binding DataContext.LocationFamilyFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
|
|||
|
|
CommandParameter="{Binding}"
|
|||
|
|
Content="浏览"
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
ToolTip="在资源管理器中浏览文件" />
|
|||
|
|
</StackPanel>
|
|||
|
|
</DataTemplate>
|
|||
|
|
</GridViewColumn.CellTemplate>
|
|||
|
|
</GridViewColumn>
|
|||
|
|
</GridView>
|
|||
|
|
</ListView.View>-->
|
|||
|
|
<ui:ListView.ItemContainerStyle>
|
|||
|
|
<Style TargetType="{x:Type ListViewItem}">
|
|||
|
|
<Setter Property="Template">
|
|||
|
|
<Setter.Value>
|
|||
|
|
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
|||
|
|
<Border
|
|||
|
|
x:Name="border"
|
|||
|
|
Margin="5"
|
|||
|
|
Background="{TemplateBinding Background}"
|
|||
|
|
BorderBrush="Transparent"
|
|||
|
|
BorderThickness="2"
|
|||
|
|
CornerRadius="5">
|
|||
|
|
<ContentPresenter />
|
|||
|
|
</Border>
|
|||
|
|
<ControlTemplate.Triggers>
|
|||
|
|
<MultiTrigger>
|
|||
|
|
<MultiTrigger.Conditions>
|
|||
|
|
<Condition Property="IsMouseOver" Value="True" />
|
|||
|
|
<Condition Property="IsSelected" Value="False" />
|
|||
|
|
</MultiTrigger.Conditions>
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="Gray" />
|
|||
|
|
</MultiTrigger>
|
|||
|
|
<Trigger Property="IsSelected" Value="True">
|
|||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="LightSkyBlue" />
|
|||
|
|
</Trigger>
|
|||
|
|
</ControlTemplate.Triggers>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</Setter.Value>
|
|||
|
|
</Setter>
|
|||
|
|
</Style>
|
|||
|
|
</ui:ListView.ItemContainerStyle>
|
|||
|
|
<ui:ListView.ItemsPanel>
|
|||
|
|
<ItemsPanelTemplate>
|
|||
|
|
<WrapPanel Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType={x:Type ScrollContentPresenter}}}" />
|
|||
|
|
</ItemsPanelTemplate>
|
|||
|
|
</ui:ListView.ItemsPanel>
|
|||
|
|
<ui:ListView.ItemTemplate>
|
|||
|
|
<DataTemplate>
|
|||
|
|
<ui:Card Padding="0">
|
|||
|
|
<Grid Width="170" Height="210">
|
|||
|
|
<Grid.RowDefinitions>
|
|||
|
|
<RowDefinition Height="170" />
|
|||
|
|
<RowDefinition Height="Auto" />
|
|||
|
|
</Grid.RowDefinitions>
|
|||
|
|
<Image
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Width="128"
|
|||
|
|
Height="128"
|
|||
|
|
Source="{Binding ImageData}"
|
|||
|
|
Stretch="Uniform"
|
|||
|
|
ToolTip="{Binding ToolTip}" />
|
|||
|
|
<StackPanel
|
|||
|
|
Grid.Row="0"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
VerticalAlignment="Bottom"
|
|||
|
|
Orientation="Horizontal">
|
|||
|
|
<StackPanel.Style>
|
|||
|
|
<Style TargetType="{x:Type StackPanel}">
|
|||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|||
|
|
<Style.Triggers>
|
|||
|
|
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}, Mode=FindAncestor}}" Value="True">
|
|||
|
|
<Setter Property="Visibility" Value="Visible" />
|
|||
|
|
</DataTrigger>
|
|||
|
|
</Style.Triggers>
|
|||
|
|
</Style>
|
|||
|
|
</StackPanel.Style>
|
|||
|
|
<ui:Button
|
|||
|
|
Appearance="Primary"
|
|||
|
|
Command="{Binding DataContext.ImportFamilyCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
|
|||
|
|
CommandParameter="{Binding}"
|
|||
|
|
Content="载入"
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
ToolTip="将族载入到当前项目" />
|
|||
|
|
<ui:Button
|
|||
|
|
Appearance="Primary"
|
|||
|
|
Command="{Binding DataContext.LocationFamilyFileCommand, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}"
|
|||
|
|
CommandParameter="{Binding}"
|
|||
|
|
Content="定位"
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
ToolTip="在资源管理器中浏览文件" />
|
|||
|
|
<!--
|
|||
|
|
CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}}"
|
|||
|
|
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource Mode=Self}}" 等价于 CommandParameter="{Binding}"
|
|||
|
|
-->
|
|||
|
|
</StackPanel>
|
|||
|
|
<TextBlock
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Width="128"
|
|||
|
|
Text="{Binding Title}"
|
|||
|
|
TextAlignment="Center"
|
|||
|
|
TextWrapping="WrapWithOverflow" />
|
|||
|
|
</Grid>
|
|||
|
|
</ui:Card>
|
|||
|
|
</DataTemplate>
|
|||
|
|
</ui:ListView.ItemTemplate>
|
|||
|
|
<ui:ListView.Template>
|
|||
|
|
<ControlTemplate TargetType="{x:Type ListView}">
|
|||
|
|
<ScrollViewer
|
|||
|
|
x:Name="scr"
|
|||
|
|
HorizontalScrollBarVisibility="Disabled"
|
|||
|
|
VerticalScrollBarVisibility="Auto">
|
|||
|
|
<i:Interaction.Triggers>
|
|||
|
|
<i:EventTrigger EventName="ScrollChanged">
|
|||
|
|
<i:InvokeCommandAction Command="{Binding LvScrollCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ScrollViewer}, Mode=FindAncestor}}" />
|
|||
|
|
</i:EventTrigger>
|
|||
|
|
</i:Interaction.Triggers>
|
|||
|
|
<WrapPanel IsItemsHost="True" ScrollViewer.CanContentScroll="True" />
|
|||
|
|
</ScrollViewer>
|
|||
|
|
</ControlTemplate>
|
|||
|
|
</ui:ListView.Template>
|
|||
|
|
</ui:ListView>
|
|||
|
|
<GridSplitter
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.Column="3"
|
|||
|
|
Width="1"
|
|||
|
|
HorizontalAlignment="Center"
|
|||
|
|
ShowsPreview="True" />
|
|||
|
|
<ui:DataGrid
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.Column="4"
|
|||
|
|
Margin="5"
|
|||
|
|
d:ItemsSource="{d:SampleData}"
|
|||
|
|
AutoGenerateColumns="False"
|
|||
|
|
CanUserAddRows="False"
|
|||
|
|
IsReadOnly="True"
|
|||
|
|
ItemsSource="{Binding SelectedItem.Parameters, ElementName=CbbSymbols, Mode=TwoWay}">
|
|||
|
|
<ui:DataGrid.Columns>
|
|||
|
|
<DataGridTextColumn Binding="{Binding Name}" Header="属性名" />
|
|||
|
|
<DataGridTextColumn Binding="{Binding Value}" Header="属性值" />
|
|||
|
|
</ui:DataGrid.Columns>
|
|||
|
|
</ui:DataGrid>
|
|||
|
|
<!--<StackPanel
|
|||
|
|
Grid.Row="1"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
Margin="5"
|
|||
|
|
HorizontalAlignment="Right"
|
|||
|
|
VerticalAlignment="Top">
|
|||
|
|
<hc:ButtonGroup Style="{StaticResource ButtonGroupSolid}">
|
|||
|
|
<RadioButton IsChecked="True" Style="{StaticResource RadioGroupItemHorizontalFirst}">
|
|||
|
|
<hc:Interaction.Triggers>
|
|||
|
|
<hc:EventTrigger EventName="Checked">
|
|||
|
|
<hc:EventToCommand Command="{Binding ModifyLayout}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}}" />
|
|||
|
|
</hc:EventTrigger>
|
|||
|
|
</hc:Interaction.Triggers>
|
|||
|
|
</RadioButton>
|
|||
|
|
<RadioButton Style="{StaticResource RadioGroupItemHorizontalLast}">
|
|||
|
|
<hc:Interaction.Triggers>
|
|||
|
|
<hc:EventTrigger EventName="Checked">
|
|||
|
|
<hc:EventToCommand Command="{Binding ModifyLayout}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=RadioButton}}" />
|
|||
|
|
</hc:EventTrigger>
|
|||
|
|
</hc:Interaction.Triggers>
|
|||
|
|
</RadioButton>
|
|||
|
|
</hc:ButtonGroup>
|
|||
|
|
</StackPanel>-->
|
|||
|
|
<ex:StackPanelEx
|
|||
|
|
Grid.Row="0"
|
|||
|
|
Grid.Column="4"
|
|||
|
|
Orientation="Horizontal">
|
|||
|
|
<ex:ComboBoxEx
|
|||
|
|
x:Name="CbbSymbols"
|
|||
|
|
ex:StackPanelEx.Fill="Fill"
|
|||
|
|
DisplayMemberPath="Name"
|
|||
|
|
ItemsSource="{Binding SymbolTypes, Mode=TwoWay}"
|
|||
|
|
PlaceholderText="选择族类型"
|
|||
|
|
SelectedItem="{Binding SelectedSymbolType, UpdateSourceTrigger=PropertyChanged}" />
|
|||
|
|
<Button
|
|||
|
|
Grid.Column="1"
|
|||
|
|
Margin="5"
|
|||
|
|
ex:StackPanelEx.Fill="Auto"
|
|||
|
|
Command="{Binding ImportFamilySymbolCommand}"
|
|||
|
|
Content=""
|
|||
|
|
FontFamily="{StaticResource BoxIcons}"
|
|||
|
|
ToolTip="载入类型" />
|
|||
|
|
</ex:StackPanelEx>
|
|||
|
|
<TextBlock
|
|||
|
|
Grid.Row="2"
|
|||
|
|
Grid.Column="0"
|
|||
|
|
Margin="5"
|
|||
|
|
Text="{Binding FamilyCount, Mode=OneWay, StringFormat=共计{}{0}个}" />
|
|||
|
|
<ui:InfoBar
|
|||
|
|
Grid.Row="2"
|
|||
|
|
Grid.Column="2"
|
|||
|
|
IsOpen="{Binding ActiveSnackbar}"
|
|||
|
|
Message="{Binding Message}" />
|
|||
|
|
<TextBlock
|
|||
|
|
Grid.Row="2"
|
|||
|
|
Grid.Column="4"
|
|||
|
|
Text="{Binding RevitVersion, Mode=OneWay, StringFormat=当前文件版本:Revit \{0\}}" />
|
|||
|
|
</Grid>
|
|||
|
|
</ex:FluentWindowEx>
|