支持多个node保存到工具栏,显示还有点问题。

This commit is contained in:
kwai
2023-02-03 18:23:53 +08:00
parent 397ebcfac2
commit 2fde666182
12 changed files with 273 additions and 140 deletions

View File

@@ -161,6 +161,57 @@
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate DataType="{x:Type model:MultipleDesignerItemToolBoxData}">
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="删除" Command="{StaticResource DeleteItemCommandReference}" CommandParameter="{Binding .}"/>
</ContextMenu>
</Grid.ContextMenu>
<Rectangle Name="Border"
StrokeThickness="1"
StrokeDashArray="2"
Fill="Transparent"
SnapsToDevicePixels="true"/>
<Viewbox Stretch="Uniform">
<ItemsControl ItemsSource="{Binding SelectableDesignerItemViewModel}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas x:Name="rootCanvas"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Template>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<Grid>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ItemWidth}" Height="{Binding ItemHeight}" IsHitTestVisible="False">
<ContentControl Content="{Binding .}" Margin="2"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Resources>
<Style TargetType="{x:Type ContentPresenter}">
<Setter Property="Canvas.Left" Value="{Binding Left}" />
<Setter Property="Canvas.Top" Value="{Binding Top}" />
</Style>
</ItemsControl.Resources>
</ItemsControl>
</Viewbox>
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate DataType="{x:Type flowchartmodel:FlowchartToolBoxData}">
<Grid Width="{Binding Width}" Height="{Binding Height}" ToolTip="{Binding Description}">
<Rectangle Name="Border"