整理代码
This commit is contained in:
257
ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerView.xaml
Normal file
257
ShrlAlgoToolkit.RevitAddins/RvView/ViewManagerView.xaml
Normal file
@@ -0,0 +1,257 @@
|
||||
<ui:FluentWindowEx
|
||||
Height="450"
|
||||
Title="视图管理"
|
||||
Width="800"
|
||||
d:DataContext="{d:DesignInstance Type=local:ViewManagerViewModel}"
|
||||
mc:Ignorable="d"
|
||||
x:Class="ShrlAlgo.RvKits.RvView.ViewManagerView"
|
||||
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.RvView"
|
||||
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:converters="clr-namespace:ShrlAlgoToolkit.Mvvm.Converters;assembly=ShrlAlgoToolkit.Mvvm"
|
||||
xmlns:assists="clr-namespace:ShrlAlgoToolkit.Mvvm.Assists;assembly=ShrlAlgoToolkit.Mvvm">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/ShrlAlgoToolkit.RevitAddins;component/WPFUI.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<converters:SearchValueConverter x:Key="SearchValueConverter" />
|
||||
<converters:EnumItemsSourceAndConverter Type="{x:Type local:UserViewDetailLevel}" x:Key="DetailLevelConverter" />
|
||||
<converters:EnumItemsSourceAndConverter Type="{x:Type local:UserViewType}" x:Key="ViewTypeConverter" />
|
||||
<converters:EnumItemsSourceAndConverter Type="{x:Type local:UserDisplayStyle}" x:Key="DisplayStyleConverter" />
|
||||
<converters:EnumItemsSourceAndConverter Type="{x:Type local:UserViewDiscipline}" x:Key="ViewDisciplineConverter" />
|
||||
<assists:BindingProxy Data="{Binding ElementName=ViewDataGrid}" x:Key="ViewDataGridProxy" />
|
||||
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<ui:AutoGrid
|
||||
ChildMargin="5"
|
||||
Columns="*,Auto,Auto"
|
||||
Rows="*,Auto">
|
||||
<DataGrid
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
EnableRowVirtualization="False"
|
||||
FrozenColumnCount="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="0"
|
||||
GridLinesVisibility="All"
|
||||
Height="380"
|
||||
ItemsSource="{Binding FilteredList}"
|
||||
SelectionMode="Extended"
|
||||
d:ItemsSource="{d:SampleData}"
|
||||
x:Name="ViewDataGrid">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="SelectionChanged">
|
||||
<!--<b:InvokeCommandAction Command="{Binding DataContext.UpdateExecuteCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />-->
|
||||
<b:InvokeCommandAction Command="{Binding UpdateExecuteCommand}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" />
|
||||
</b:EventTrigger>
|
||||
|
||||
<!--<b:EventTrigger EventName="CellEditEnding">
|
||||
<b:InvokeCommandAction Command="{Binding UpdatePropertyCommand}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" />
|
||||
</b:EventTrigger>-->
|
||||
</b:Interaction.Triggers>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem
|
||||
Command="{Binding CopyOnlyCommand}"
|
||||
CommandParameter="{Binding Data.SelectedItems, Source={StaticResource ViewDataGridProxy}}"
|
||||
Header="复制" />
|
||||
<MenuItem
|
||||
Command="{Binding CopyWithDetailCommand}"
|
||||
CommandParameter="{Binding Data.SelectedItems, Source={StaticResource ViewDataGridProxy}}"
|
||||
Header="带细节复制" />
|
||||
<MenuItem
|
||||
Command="{Binding CopyAsDependentCommand}"
|
||||
CommandParameter="{Binding Data.SelectedItems, Source={StaticResource ViewDataGridProxy}}"
|
||||
Header="复制作为相关" />
|
||||
<MenuItem
|
||||
Command="{Binding DeleteCommand}"
|
||||
CommandParameter="{Binding Data.SelectedItems, Source={StaticResource ViewDataGridProxy}}"
|
||||
Header="删除视图" />
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<!--<DataGrid.RowHeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGrid.RowHeaderTemplate>-->
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="80">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Content="全选">
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="Checked">
|
||||
<b:CallMethodAction MethodName="SelectAll" TargetObject="{Binding ElementName=ViewDataGrid}" />
|
||||
</b:EventTrigger>
|
||||
<b:EventTrigger EventName="Unchecked">
|
||||
<b:CallMethodAction MethodName="UnselectAll" TargetObject="{Binding ElementName=ViewDataGrid}" />
|
||||
</b:EventTrigger>
|
||||
</b:Interaction.Triggers>
|
||||
</CheckBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource DefaultTextBoxStyle}"
|
||||
Header="视图名称">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding UserViewType, Converter={StaticResource ViewTypeConverter}, Mode=OneTime}"
|
||||
Header="视图类型"
|
||||
IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTemplateColumn Header="视图比例">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
IsEnabled="{Binding IsScaleEditable}"
|
||||
Text="1:"
|
||||
VerticalAlignment="Center" />
|
||||
<!--<TextBox IsEnabled="{Binding IsScaleEditable}" Text="{Binding Scale, StringFormat={}1:{0}}" />-->
|
||||
<TextBox IsEnabled="{Binding IsScaleEditable}" Text="{Binding Scale, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--<DataGridTemplateColumn Header="视图样板">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Style="{x:Null}" Text="{Binding ViewTemplate}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Name"
|
||||
ItemsSource="{Binding DataContext.ViewTemplates, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
|
||||
SelectedItem="{Binding ViewTemplate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValue="Value"
|
||||
Style="{StaticResource mdDataGridComboBox}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
<DataGridTemplateColumn Header="图形显示">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
IsEnabled="{Binding IsDisplayStyleEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource DisplayStyleConverter}}"
|
||||
SelectedItem="{Binding DisplayStyle, Converter={StaticResource DisplayStyleConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="详细程度">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
IsEnabled="{Binding IsDetailLevelEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource DetailLevelConverter}}"
|
||||
SelectedItem="{Binding DetailLevel, Converter={StaticResource DetailLevelConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--<DataGridComboBoxColumn
|
||||
Header="详细程度"
|
||||
ItemsSource="{Binding Source={StaticResource DetailLevelConverter}}"
|
||||
SelectedValueBinding="{Binding DetailLevel, Mode=TwoWay, Converter={StaticResource DetailLevelConverter}, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGridComboBoxColumn.EditingElementStyle>
|
||||
<Style BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="ComboBox">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsDetailLevelEditable}" />
|
||||
</Style>
|
||||
</DataGridComboBoxColumn.EditingElementStyle>
|
||||
<DataGridComboBoxColumn.ElementStyle>
|
||||
<Style TargetType="ComboBox">
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridComboBoxColumn.ElementStyle>
|
||||
</DataGridComboBoxColumn>-->
|
||||
<DataGridTemplateColumn Header="视图样板">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Name"
|
||||
IsEnabled="{Binding IsViewTemplateEditable}"
|
||||
ItemsSource="{Binding ViewTemplates}"
|
||||
SelectedItem="{Binding ViewTemplate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="规程">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
IsEnabled="{Binding IsDisciplineEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource ViewDisciplineConverter}}"
|
||||
SelectedItem="{Binding Discipline, Converter={StaticResource ViewDisciplineConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="图纸编号">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox IsEnabled="{Binding IsSheetNumberEditable}" Text="{Binding SheetNumber, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="图纸上的标题">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox IsEnabled="{Binding IsSheetNameEditable}" Text="{Binding SheetName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<ui:TextBox
|
||||
Cursor="IBeam"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
PlaceholderText="搜索视图"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
||||
x:Name="TbSearch" />
|
||||
<ui:Button
|
||||
Command="{Binding SearchCommand}"
|
||||
Content="搜索"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Icon="{ui:SymbolIcon Search24}"
|
||||
IsDefault="True" />
|
||||
<ui:Button
|
||||
Command="{Binding ConfirmCommand}"
|
||||
Content="应用"
|
||||
Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
Icon="{ui:SymbolIcon EditSettings20}" />
|
||||
|
||||
</ui:AutoGrid>
|
||||
</ui:FluentWindowEx>
|
||||
Reference in New Issue
Block a user