mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
增加自定义 DesignerItemView 样式
This commit is contained in:
@@ -83,7 +83,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockItemsContainer _sourceItemsContainer;
|
private BlockItemsContainer _sourceItemsContainer;
|
||||||
public BlockItemsContainer SourceItemsContainer
|
public BlockItemsContainer SourceItemsContainer
|
||||||
{
|
{
|
||||||
@@ -250,7 +250,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
this.Loaded += DesignerCanvas_Loaded;
|
this.Loaded += DesignerCanvas_Loaded;
|
||||||
this.IsVisibleChanged += DesignerCanvas_IsVisibleChanged;
|
this.IsVisibleChanged += DesignerCanvas_IsVisibleChanged;
|
||||||
this.DataContextChanged += DesignerCanvas_DataContextChanged;
|
this.DataContextChanged += DesignerCanvas_DataContextChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DesignerCanvas_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
private void DesignerCanvas_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||||
@@ -275,7 +275,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DesignerCanvas_Loaded(object sender, RoutedEventArgs e)
|
protected void DesignerCanvas_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Mediator.Instance.Register(this);
|
Mediator.Instance.Register(this);
|
||||||
this.Focus();
|
this.Focus();
|
||||||
@@ -575,7 +575,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
else if (SourceItemsContainer != null)
|
else if (SourceItemsContainer != null)
|
||||||
{
|
{
|
||||||
( _viewModel as IBlockDiagramViewModel).FinishNearBlock(new System.Collections.Generic.List<BlockDesignerItemViewModel> { SourceItemsContainer.DragObject });
|
(_viewModel as IBlockDiagramViewModel).FinishNearBlock(new System.Collections.Generic.List<BlockDesignerItemViewModel> { SourceItemsContainer.DragObject });
|
||||||
ExitCursor();
|
ExitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;
|
DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;
|
||||||
if (dragObject != null && (dragObject.ContentType == typeof(BlockDesignerItemViewModel) || dragObject.ContentType.IsSubclassOf(typeof(BlockDesignerItemViewModel))))
|
if (dragObject != null && (dragObject.ContentType == typeof(BlockDesignerItemViewModel) || dragObject.ContentType.IsSubclassOf(typeof(BlockDesignerItemViewModel))))
|
||||||
{
|
{
|
||||||
var position = e.GetPosition(this);
|
var position = e.GetPosition(this);
|
||||||
|
|
||||||
BlockDesignerItemViewModel itemBase = Activator.CreateInstance(dragObject.ContentType) as BlockDesignerItemViewModel;
|
BlockDesignerItemViewModel itemBase = Activator.CreateInstance(dragObject.ContentType) as BlockDesignerItemViewModel;
|
||||||
itemBase.Text = dragObject.Text;
|
itemBase.Text = dragObject.Text;
|
||||||
@@ -682,8 +682,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
itemBase.Top = Math.Max(0, position.Y - itemBase.GetItemHeight() / 2);
|
itemBase.Top = Math.Max(0, position.Y - itemBase.GetItemHeight() / 2);
|
||||||
|
|
||||||
(_viewModel as IBlockDiagramViewModel)?.PreviewNearBlock(new System.Collections.Generic.List<BlockDesignerItemViewModel> { itemBase });
|
(_viewModel as IBlockDiagramViewModel)?.PreviewNearBlock(new System.Collections.Generic.List<BlockDesignerItemViewModel> { itemBase });
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnDragOver(e);
|
base.OnDragOver(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
}
|
}
|
||||||
itemBase.Left = Math.Max(0, position.X - itemBase.GetItemWidth() / 2);
|
itemBase.Left = Math.Max(0, position.X - itemBase.GetItemWidth() / 2);
|
||||||
itemBase.Top = Math.Max(0, position.Y - itemBase.GetItemHeight() / 2);
|
itemBase.Top = Math.Max(0, position.Y - itemBase.GetItemHeight() / 2);
|
||||||
_viewModel.AddCommand.Execute(itemBase);
|
_viewModel.AddCommand.Execute(itemBase);
|
||||||
|
|
||||||
if (itemBase is BlockDesignerItemViewModel block)
|
if (itemBase is BlockDesignerItemViewModel block)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
@@ -20,6 +18,25 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ConcurrentDictionary<Type, string> _styles = new ConcurrentDictionary<Type, string>();
|
||||||
|
|
||||||
|
public void RegisterDesignerItemControlItemStyle(Type type, string resourceName)
|
||||||
|
{
|
||||||
|
if (_styles.ContainsKey(type))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"{type}-{resourceName} already exists");
|
||||||
|
}
|
||||||
|
_styles.TryAdd(type, resourceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterDesignerItemControlItemStyle(Type type, string resourceName, bool isCover)
|
||||||
|
{
|
||||||
|
if (_styles.ContainsKey(type))
|
||||||
|
{
|
||||||
|
_styles[type] = resourceName;
|
||||||
|
}
|
||||||
|
_styles.TryAdd(type, resourceName);
|
||||||
|
}
|
||||||
|
|
||||||
public override Style SelectStyle(object item, DependencyObject container)
|
public override Style SelectStyle(object item, DependencyObject container)
|
||||||
{
|
{
|
||||||
@@ -27,6 +44,28 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
if (itemsControl == null)
|
if (itemsControl == null)
|
||||||
throw new InvalidOperationException("DesignerItemsControlItemStyleSelector : Could not find ItemsControl");
|
throw new InvalidOperationException("DesignerItemsControlItemStyleSelector : Could not find ItemsControl");
|
||||||
|
|
||||||
|
if (!_styles.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
var type = item.GetType();
|
||||||
|
if (_styles.ContainsKey(type))
|
||||||
|
{
|
||||||
|
return (Style)itemsControl.FindResource(_styles[type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var styleItem in _styles)
|
||||||
|
{
|
||||||
|
if (type.IsSubclassOf(styleItem.Key))
|
||||||
|
{
|
||||||
|
return (Style)itemsControl.FindResource(styleItem.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.IsAssignableFrom(styleItem.Key))
|
||||||
|
{
|
||||||
|
return (Style)itemsControl.FindResource(styleItem.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item is GifImageItemViewModel)
|
if (item is GifImageItemViewModel)
|
||||||
{
|
{
|
||||||
return (Style)itemsControl.FindResource("gifimageItemStyle");
|
return (Style)itemsControl.FindResource("gifimageItemStyle");
|
||||||
@@ -46,13 +85,13 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
return (Style)itemsControl.FindResource("designerItemStyle");
|
return (Style)itemsControl.FindResource("designerItemStyle");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is ConnectionViewModel)
|
if (item is ConnectionViewModel)
|
||||||
{
|
{
|
||||||
return (Style)itemsControl.FindResource("connectorItemStyle");
|
return (Style)itemsControl.FindResource("connectorItemStyle");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
890
AIStudio.Wpf.DiagramDesigner/Themes/DiagramControl.xaml
Normal file
890
AIStudio.Wpf.DiagramDesigner/Themes/DiagramControl.xaml
Normal file
@@ -0,0 +1,890 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||||
|
xmlns:c="clr-namespace:AIStudio.Wpf.DiagramDesigner.Controls"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
|
>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Themes/Generic.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
|
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||||
|
<dd:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
|
<dd:NotNullOrEmptyToBoolConverter x:Key="NotNullOrEmptyToBoolConverter"/>
|
||||||
|
|
||||||
|
<!-- ResizeDecorator Default Template -->
|
||||||
|
<!--
|
||||||
|
<ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="{x:Type Control}">
|
||||||
|
<Grid SnapsToDevicePixels="true">
|
||||||
|
<c:ResizeThumb Height="1" Cursor="SizeNS" Margin="0 0 0 0"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
|
||||||
|
<c:ResizeThumb Width="1" Cursor="SizeWE" Margin="0 0 0 0"
|
||||||
|
VerticalAlignment="Stretch" HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="1" Cursor="SizeWE" Margin="0 0 0 0"
|
||||||
|
VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
||||||
|
<c:ResizeThumb Height="1" Cursor="SizeNS" Margin="0 0 0 0"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>
|
||||||
|
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-3 -3 0 0"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -3 -3 0"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||||
|
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-3 0 0 -3"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -3 -3"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>-->
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Shape}" x:Key="ThumbCorner">
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||||
|
<Setter Property="Stroke" Value="#FFC8C8C8" />
|
||||||
|
<Setter Property="StrokeThickness" Value=".5" />
|
||||||
|
<Setter Property="Width" Value="7" />
|
||||||
|
<Setter Property="Height" Value="7" />
|
||||||
|
<Setter Property="Margin" Value="-2" />
|
||||||
|
<Setter Property="Fill">
|
||||||
|
<Setter.Value>
|
||||||
|
<RadialGradientBrush Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
|
||||||
|
<GradientStop Color="White" Offset="0.0" />
|
||||||
|
<GradientStop Color="Gray" Offset="0.8" />
|
||||||
|
</RadialGradientBrush>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--ResizeDecorator Default Template-->
|
||||||
|
<ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="{x:Type Control}">
|
||||||
|
<Grid>
|
||||||
|
<Grid Opacity="0" Margin="-3">
|
||||||
|
<c:RotateThumb x:Name="rotate" Width="7"
|
||||||
|
Height="7"
|
||||||
|
Margin="0,-20,0,0"
|
||||||
|
Cursor="Hand"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center"/>
|
||||||
|
<c:ResizeThumb Height="3"
|
||||||
|
Cursor="SizeNS"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Stretch"/>
|
||||||
|
<c:ResizeThumb Width="3"
|
||||||
|
Cursor="SizeWE"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="3"
|
||||||
|
Cursor="SizeWE"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Right"/>
|
||||||
|
<c:ResizeThumb Height="3"
|
||||||
|
Cursor="SizeNS"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Stretch"/>
|
||||||
|
<c:ResizeThumb Width="7"
|
||||||
|
Height="7"
|
||||||
|
Margin="-2"
|
||||||
|
Cursor="SizeNWSE"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="7"
|
||||||
|
Height="7"
|
||||||
|
Margin="-2"
|
||||||
|
Cursor="SizeNESW"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Right"/>
|
||||||
|
<c:ResizeThumb Width="7"
|
||||||
|
Height="7"
|
||||||
|
Margin="-2"
|
||||||
|
Cursor="SizeNESW"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
<c:ResizeThumb Width="7"
|
||||||
|
Height="7"
|
||||||
|
Margin="-2"
|
||||||
|
Cursor="SizeNWSE"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid IsHitTestVisible="False" Opacity="1" Margin="-3">
|
||||||
|
<Rectangle SnapsToDevicePixels="True"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Margin="1"
|
||||||
|
Stroke="Gray"/>
|
||||||
|
<Line x:Name="line" StrokeThickness="1" X1="0" Y1="0" X2="0" Y2="20"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Margin="0,-19,0,0"
|
||||||
|
Stroke="Gray"/>
|
||||||
|
<Ellipse x:Name="top" Style="{StaticResource ThumbCorner}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-1,-20,0,0"/>
|
||||||
|
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||||
|
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
||||||
|
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
|
||||||
|
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ShowRotate}" Value="false">
|
||||||
|
<Setter TargetName="rotate" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="line" Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Setter TargetName="top" Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ObjectDataProvider x:Key="ConnectorOrientationMenu" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
|
||||||
|
<ObjectDataProvider.MethodParameters>
|
||||||
|
<x:Type TypeName="dd:ConnectorOrientation" />
|
||||||
|
</ObjectDataProvider.MethodParameters>
|
||||||
|
</ObjectDataProvider>
|
||||||
|
|
||||||
|
<Style x:Key="CinchMenuItemStyle" TargetType="{x:Type MenuItem}" >
|
||||||
|
<Setter Property="Header" Value="{Binding Text}" />
|
||||||
|
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
||||||
|
<Setter Property="Command" Value="{Binding Command}" />
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Connector Style -->
|
||||||
|
<Style x:Key="PointConnectorStyle" TargetType="{x:Type dd:PointConnector}">
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
||||||
|
<Grid Width="{Binding ConnectorWidth}" Height="{Binding ConnectorHeight}">
|
||||||
|
<!-- transparent extra space makes connector easier to hit -->
|
||||||
|
<Ellipse Fill="Transparent" Margin="-3" />
|
||||||
|
<Ellipse Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ConnectorVertexType}" Value="Start">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
||||||
|
<Grid Width="{Binding ConnectorWidth}"
|
||||||
|
Height="{Binding ConnectorHeight}"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
SnapsToDevicePixels="True">
|
||||||
|
<Ellipse Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Margin="-2.5"/>
|
||||||
|
<Rectangle
|
||||||
|
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
Margin="1"/>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ConnectorVertexType}" Value="End">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
||||||
|
<Grid Width="{Binding ConnectorWidth}"
|
||||||
|
Height="{Binding ConnectorHeight}"
|
||||||
|
UseLayoutRounding="True"
|
||||||
|
SnapsToDevicePixels="True">
|
||||||
|
<Ellipse Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
StrokeThickness="1"
|
||||||
|
Margin="-2.5"/>
|
||||||
|
<Ellipse
|
||||||
|
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||||
|
Margin="1"/>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="GifImageConnectorContainer" TargetType="{x:Type dd:ConnectorContainer}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<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>
|
||||||
|
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<i:Interaction.Behaviors>
|
||||||
|
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddCommand}" />
|
||||||
|
</i:Interaction.Behaviors>
|
||||||
|
</Rectangle>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ItemsControlStyle" TargetType="{x:Type ItemsControl}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<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>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="ConnectorDecoratorTemplate"
|
||||||
|
TargetType="{x:Type Control}">
|
||||||
|
<Grid Margin="{Binding ConnectorMargin}">
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding LeftConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding TopLeftConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="TopLeft"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding TopConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Top"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding TopRightConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="TopRight"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding RightConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding BottomRightConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="BottomRight"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding BottomConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Bottom"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding BottomLeftConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="BottomLeft"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||||
|
<!--<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
||||||
|
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
||||||
|
</Button>
|
||||||
|
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
||||||
|
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
||||||
|
</Button>
|
||||||
|
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
||||||
|
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
||||||
|
</Button>
|
||||||
|
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
||||||
|
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
||||||
|
</Button>-->
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="InnerConnectorDecoratorTemplate"
|
||||||
|
TargetType="{x:Type Control}">
|
||||||
|
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}">
|
||||||
|
<dd:ConnectorContainer.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<dd:Connector
|
||||||
|
Content="{Binding .}"
|
||||||
|
SnapsToDevicePixels="True"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</dd:ConnectorContainer.ItemTemplate>
|
||||||
|
</dd:ConnectorContainer>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<ControlTemplate x:Key="BlockConnectorDecoratorTemplate"
|
||||||
|
TargetType="{x:Type Control}">
|
||||||
|
<Grid Margin="{Binding ConnectorMargin}">
|
||||||
|
<dd:BlockConnector
|
||||||
|
Content="{Binding LeftConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Left"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
<dd:BlockConnector
|
||||||
|
Content="{Binding TopConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Top"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Stretch"/>
|
||||||
|
<dd:BlockConnector
|
||||||
|
Content="{Binding RightConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Right"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalAlignment="Right"/>
|
||||||
|
<dd:BlockConnector
|
||||||
|
Content="{Binding BottomConnector}"
|
||||||
|
SnapsToDevicePixels="True"
|
||||||
|
Orientation="Bottom"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
HorizontalAlignment="Stretch"/>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
|
<!--基础类型-->
|
||||||
|
<Style x:Key="designerItemStyle"
|
||||||
|
TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Left"
|
||||||
|
Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.Top"
|
||||||
|
Value="{Binding Top}" />
|
||||||
|
<Setter Property="Canvas.ZIndex"
|
||||||
|
Value="{Binding ZIndex}" />
|
||||||
|
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||||
|
Value="{Binding EnabledForSelection}" />
|
||||||
|
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||||
|
Value="{Binding EnabledForConnection}" />
|
||||||
|
<Setter Property="Visibility"
|
||||||
|
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="{Binding ItemWidth}" />
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="{Binding ItemHeight}" />
|
||||||
|
<Setter Property="MinWidth"
|
||||||
|
Value="{Binding MinItemWidth}" />
|
||||||
|
<Setter Property="MinHeight"
|
||||||
|
Value="{Binding MinItemHeight}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels"
|
||||||
|
Value="True" />
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<ContextMenu.ItemContainerStyle>
|
||||||
|
<Style TargetType="MenuItem">
|
||||||
|
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
||||||
|
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
||||||
|
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
||||||
|
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
||||||
|
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
||||||
|
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
||||||
|
</Style>
|
||||||
|
</ContextMenu.ItemContainerStyle>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
<!-- PART_DragThumb -->
|
||||||
|
<c:DragThumb x:Name="PART_DragThumb"
|
||||||
|
Cursor="SizeAll" >
|
||||||
|
<c:DragThumb.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</c:DragThumb.InputBindings>
|
||||||
|
</c:DragThumb>
|
||||||
|
|
||||||
|
<Grid RenderTransformOrigin="0.5,0.5">
|
||||||
|
|
||||||
|
<!-- PART_ResizeDecorator -->
|
||||||
|
<Control x:Name="PART_ResizeDecorator"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- PART_ContentPresenter -->
|
||||||
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Content="{TemplateBinding Content}" />
|
||||||
|
|
||||||
|
<Control x:Name="PART_Text" Margin="1" IsHitTestVisible="{Binding IsReadOnlyText,Converter={StaticResource InvertBoolConverter}}">
|
||||||
|
<Control.Style>
|
||||||
|
<Style TargetType="Control">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid/>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ShowText}" Value="True">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<dd:TextControl x:Name="PART_Text" />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding Text,Converter={StaticResource NotNullOrEmptyToBoolConverter}}" Value="True">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<dd:TextControl x:Name="PART_Text" />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding CustomText}" Value="True">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid/>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Control.Style>
|
||||||
|
</Control>
|
||||||
|
|
||||||
|
<!-- PART_ConnectorDecorator -->
|
||||||
|
<Control x:Name="PART_ConnectorDecorator" Template="{StaticResource ConnectorDecoratorTemplate}"/>
|
||||||
|
|
||||||
|
<Grid.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="{Binding Angle}" />
|
||||||
|
<ScaleTransform x:Name="scale" ScaleX="{Binding ScaleX}" ScaleY="{Binding ScaleY}"></ScaleTransform>
|
||||||
|
</TransformGroup>
|
||||||
|
</Grid.RenderTransform>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding IsSelected}" Value="True" />
|
||||||
|
<Condition Binding="{Binding ParentId}" Value="{x:Static sys:Guid.Empty}" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding IsSelected}" Value="True" />
|
||||||
|
<Condition Binding="{Binding AlwayForResized}" Value="True" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding Connectors.Count}" Value="0">
|
||||||
|
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Collapsed" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding IsInnerConnector}" Value="True">
|
||||||
|
<Setter TargetName="PART_ConnectorDecorator" Property="Template" Value="{StaticResource InnerConnectorDecoratorTemplate}" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding SelectedDisable}" Value="True">
|
||||||
|
<Setter TargetName="selectedGrid" Property="IsHitTestVisible" Value="False" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect BlurRadius="10" Color="{Binding ColorViewModel.ShadowColor}"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ColorViewModel.ShadowColor}" Value="Transparent">
|
||||||
|
<Setter Property="Effect" Value="{x:Null}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--连接线-->
|
||||||
|
<Style x:Key="connectorItemStyle"
|
||||||
|
TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="{Binding Area.Width}" />
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="{Binding Area.Height}" />
|
||||||
|
<Setter Property="Canvas.Top"
|
||||||
|
Value="{Binding Area.Top}" />
|
||||||
|
<Setter Property="Canvas.Left"
|
||||||
|
Value="{Binding Area.Left}" />
|
||||||
|
<Setter Property="Canvas.ZIndex"
|
||||||
|
Value="{Binding ZIndex}" />
|
||||||
|
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||||
|
Value="{Binding EnabledForSelection}" />
|
||||||
|
<Setter Property="Visibility"
|
||||||
|
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}">
|
||||||
|
<Grid.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</Grid.InputBindings>
|
||||||
|
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu x:Name="PART_ContextMenu">
|
||||||
|
<MenuItem Header="删除" Command="{Binding DeleteConnectionCommand}" CommandParameter="{Binding}"/>
|
||||||
|
<MenuItem Header="添加文本" Command="{Binding AddLabelCommand}" CommandParameter="{Binding}"/>
|
||||||
|
<MenuItem Header="插入点(按住ctrl可一直插入)" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" IsEnabled="{Binding IsReadOnly,Converter={dd:InvertBoolConverter}}" />
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
<dd:LineControl x:Name="line"/>
|
||||||
|
|
||||||
|
<!-- PART_DragThumb -->
|
||||||
|
<c:DragThumb x:Name="PART_DragThumb" Margin="{Binding DragThumbMargin}"
|
||||||
|
Cursor="SizeAll" >
|
||||||
|
<c:DragThumb.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</c:DragThumb.InputBindings>
|
||||||
|
</c:DragThumb>
|
||||||
|
|
||||||
|
<dd:PointContainer x:Name="PART_VerticesContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Vertices}" Visibility="Collapsed">
|
||||||
|
<dd:PointContainer.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="删除" Command="{Binding DeleteVertexCommand}" CommandParameter="{Binding}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
<dd:PointConnector Style="{StaticResource PointConnectorStyle}"/>
|
||||||
|
<c:PointDragThumb Cursor="SizeAll" Opacity="0"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</dd:PointContainer.ItemTemplate>
|
||||||
|
<dd:PointContainer.Resources>
|
||||||
|
<Style TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
||||||
|
</Style>
|
||||||
|
</dd:PointContainer.Resources>
|
||||||
|
</dd:PointContainer>
|
||||||
|
|
||||||
|
<dd:PointContainer x:Name="PART_LabelsContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Labels}" >
|
||||||
|
<dd:PointContainer.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid dd:SelectionProps.EnabledForSelection="True" Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}">
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="删除" Command="{Binding DeleteLabelCommand}" CommandParameter="{Binding}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
<c:PointDragThumb Cursor="SizeAll" Opacity="0">
|
||||||
|
<c:PointDragThumb.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</c:PointDragThumb.InputBindings>
|
||||||
|
</c:PointDragThumb>
|
||||||
|
<dd:TextControl Margin="5" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</dd:PointContainer.ItemTemplate>
|
||||||
|
<dd:PointContainer.Resources>
|
||||||
|
<Style TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
||||||
|
</Style>
|
||||||
|
</dd:PointContainer.Resources>
|
||||||
|
</dd:PointContainer>
|
||||||
|
|
||||||
|
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<i:Interaction.Behaviors>
|
||||||
|
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddVertexCommand}" />
|
||||||
|
</i:Interaction.Behaviors>
|
||||||
|
</Rectangle>
|
||||||
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSelected}" Value="True">
|
||||||
|
<Setter TargetName="PART_VerticesContainer" Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
|
||||||
|
<DataTrigger Binding="{Binding ShouldInsertAnchor}" Value="True">
|
||||||
|
<Setter TargetName="PART_VerticesContainer" Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
|
||||||
|
</DataTemplate.Triggers>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--自带的Gif样式-->
|
||||||
|
<Style x:Key="gifimageItemStyle"
|
||||||
|
TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Top"
|
||||||
|
Value="{Binding Top}" />
|
||||||
|
<Setter Property="Canvas.Left"
|
||||||
|
Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.ZIndex"
|
||||||
|
Value="{Binding ZIndex}" />
|
||||||
|
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||||
|
Value="{Binding EnabledForSelection}" />
|
||||||
|
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||||
|
Value="{Binding EnabledForConnection}" />
|
||||||
|
<Setter Property="Visibility"
|
||||||
|
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="{Binding ItemWidth}" />
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="{Binding ItemHeight}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels"
|
||||||
|
Value="True" />
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}">
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="插入点" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" />
|
||||||
|
<MenuItem Header="选择" ItemsSource="{Binding MenuOptions}" ItemContainerStyle="{StaticResource CinchMenuItemStyle}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
<!-- PART_DragThumb -->
|
||||||
|
<c:DragThumb x:Name="PART_DragThumb"
|
||||||
|
Cursor="SizeAll" />
|
||||||
|
<Grid RenderTransformOrigin="0.5,0.5">
|
||||||
|
<!-- PART_ResizeDecorator -->
|
||||||
|
<Control x:Name="PART_ResizeDecorator"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
||||||
|
<!-- PART_ContentPresenter -->
|
||||||
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Content="{TemplateBinding Content}" />
|
||||||
|
<!-- PART_ConnectorDecorator -->
|
||||||
|
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Visibility="Hidden" Style="{StaticResource GifImageConnectorContainer}" ItemsSource="{Binding Connectors}">
|
||||||
|
<dd:ConnectorContainer.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<dd:Connector Content="{Binding .}" SnapsToDevicePixels="True"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</dd:ConnectorContainer.ItemTemplate>
|
||||||
|
</dd:ConnectorContainer>
|
||||||
|
<Grid.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="{Binding Angle}" />
|
||||||
|
<ScaleTransform x:Name="scale" ScaleX="{Binding ScaleX}" ScaleY="{Binding ScaleY}"></ScaleTransform>
|
||||||
|
</TransformGroup>
|
||||||
|
</Grid.RenderTransform>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding IsSelected}" Value="True" />
|
||||||
|
<Condition Binding="{Binding ParentId}" Value="{x:Static sys:Guid.Empty}" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true">
|
||||||
|
<Setter TargetName="PART_ConnectorContainer" Property="Visibility" Value="Visible" />
|
||||||
|
</Trigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--自带的logical样式-->
|
||||||
|
<Style x:Key="logicalItemStyle"
|
||||||
|
TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Top"
|
||||||
|
Value="{Binding Top}" />
|
||||||
|
<Setter Property="Canvas.Left"
|
||||||
|
Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.ZIndex"
|
||||||
|
Value="{Binding ZIndex}" />
|
||||||
|
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||||
|
Value="{Binding EnabledForSelection}" />
|
||||||
|
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||||
|
Value="{Binding EnabledForConnection}" />
|
||||||
|
<Setter Property="Visibility"
|
||||||
|
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="{Binding ItemWidth}" />
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="{Binding ItemHeight}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels"
|
||||||
|
Value="True" />
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid x:Name="selectedGrid">
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<ContextMenu.ItemContainerStyle>
|
||||||
|
<Style TargetType="MenuItem">
|
||||||
|
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
||||||
|
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
||||||
|
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
||||||
|
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
||||||
|
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
||||||
|
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
||||||
|
</Style>
|
||||||
|
</ContextMenu.ItemContainerStyle>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
<!--PART_ConnectorDecorator-->
|
||||||
|
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Margin="0,0,0,0">
|
||||||
|
<dd:ConnectorContainer.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid>
|
||||||
|
<dd:Connector Content="{Binding .}" SnapsToDevicePixels="True"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</dd:ConnectorContainer.ItemTemplate>
|
||||||
|
</dd:ConnectorContainer>
|
||||||
|
<!-- PART_DragThumb -->
|
||||||
|
<c:DragThumb x:Name="PART_DragThumb"
|
||||||
|
Cursor="SizeAll" >
|
||||||
|
<c:DragThumb.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</c:DragThumb.InputBindings>
|
||||||
|
</c:DragThumb>
|
||||||
|
<!-- PART_ResizeDecorator -->
|
||||||
|
<Control x:Name="PART_ResizeDecorator"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
||||||
|
<!-- PART_ContentPresenter -->
|
||||||
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Content="{TemplateBinding Content}" />
|
||||||
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Value="True" Binding="{Binding IsSelected}"/>
|
||||||
|
<Condition Value="{x:Static sys:Guid.Empty}" Binding="{Binding ParentId}"/>
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--自带的block基础类型-->
|
||||||
|
<Style x:Key="blockItemStyle"
|
||||||
|
TargetType="{x:Type ContentPresenter}">
|
||||||
|
<Setter Property="Canvas.Left"
|
||||||
|
Value="{Binding Left}" />
|
||||||
|
<Setter Property="Canvas.Top"
|
||||||
|
Value="{Binding Top}" />
|
||||||
|
<Setter Property="Canvas.ZIndex"
|
||||||
|
Value="{Binding ZIndex}" />
|
||||||
|
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||||
|
Value="{Binding EnabledForSelection}" />
|
||||||
|
<Setter Property="Visibility"
|
||||||
|
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||||
|
<Setter Property="Width"
|
||||||
|
Value="{Binding ItemWidth}" />
|
||||||
|
<Setter Property="Height"
|
||||||
|
Value="{Binding ItemHeight}" />
|
||||||
|
<Setter Property="MinWidth"
|
||||||
|
Value="{Binding MinItemWidth}" />
|
||||||
|
<Setter Property="MinHeight"
|
||||||
|
Value="{Binding MinItemHeight}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels"
|
||||||
|
Value="True" />
|
||||||
|
<Setter Property="dd:WidthAndHeightProps.Active"
|
||||||
|
Value="true" />
|
||||||
|
<Setter Property="dd:WidthAndHeightProps.BoundActualWidth"
|
||||||
|
Value="{Binding ActualItemWidth,Mode=OneWayToSource}" />
|
||||||
|
<Setter Property="dd:WidthAndHeightProps.BoundActualHeight"
|
||||||
|
Value="{Binding ActualItemHeight,Mode=OneWayToSource}" />
|
||||||
|
<Setter Property="ContentTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
|
<ContextMenu.ItemContainerStyle>
|
||||||
|
<Style TargetType="MenuItem">
|
||||||
|
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
||||||
|
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
||||||
|
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
||||||
|
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
||||||
|
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
||||||
|
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
||||||
|
</Style>
|
||||||
|
</ContextMenu.ItemContainerStyle>
|
||||||
|
</ContextMenu>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
|
||||||
|
<!-- PART_DragThumb -->
|
||||||
|
<c:DragThumb x:Name="PART_DragThumb"
|
||||||
|
Cursor="SizeAll" >
|
||||||
|
<c:DragThumb.InputBindings>
|
||||||
|
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||||
|
</c:DragThumb.InputBindings>
|
||||||
|
</c:DragThumb>
|
||||||
|
|
||||||
|
<Grid RenderTransformOrigin="0.5,0.5" >
|
||||||
|
<!-- PART_ContentPresenter -->
|
||||||
|
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Content="{TemplateBinding Content}" />
|
||||||
|
|
||||||
|
<!-- PART_ConnectorDecorator -->
|
||||||
|
<Control x:Name="PART_ConnectorDecorator" Template="{StaticResource BlockConnectorDecoratorTemplate}"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Connectors.Count}" Value="0">
|
||||||
|
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Collapsed" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Effect">
|
||||||
|
<Setter.Value>
|
||||||
|
<DropShadowEffect BlurRadius="10" Color="{Binding ColorViewModel.ShadowColor}"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ColorViewModel.ShadowColor}" Value="Transparent">
|
||||||
|
<Setter Property="Effect" Value="{x:Null}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
@@ -10,889 +10,14 @@
|
|||||||
mc:Ignorable="d" HorizontalAlignment="Center" VerticalAlignment="Center"
|
mc:Ignorable="d" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
|
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Themes/Generic.xaml" />
|
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Themes/DiagramControl.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
||||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
|
||||||
<dd:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
|
||||||
<dd:NotNullOrEmptyToBoolConverter x:Key="NotNullOrEmptyToBoolConverter"/>
|
|
||||||
|
|
||||||
<!-- ResizeDecorator Default Template -->
|
|
||||||
<!--
|
|
||||||
<ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="{x:Type Control}">
|
|
||||||
<Grid SnapsToDevicePixels="true">
|
|
||||||
<c:ResizeThumb Height="1" Cursor="SizeNS" Margin="0 0 0 0"
|
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
|
|
||||||
<c:ResizeThumb Width="1" Cursor="SizeWE" Margin="0 0 0 0"
|
|
||||||
VerticalAlignment="Stretch" HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="1" Cursor="SizeWE" Margin="0 0 0 0"
|
|
||||||
VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
|
||||||
<c:ResizeThumb Height="1" Cursor="SizeNS" Margin="0 0 0 0"
|
|
||||||
VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>
|
|
||||||
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-3 -3 0 0"
|
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -3 -3 0"
|
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
|
||||||
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-3 0 0 -3"
|
|
||||||
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -3 -3"
|
|
||||||
VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>-->
|
|
||||||
|
|
||||||
<Style TargetType="{x:Type Shape}" x:Key="ThumbCorner">
|
|
||||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
|
||||||
<Setter Property="Stroke" Value="#FFC8C8C8" />
|
|
||||||
<Setter Property="StrokeThickness" Value=".5" />
|
|
||||||
<Setter Property="Width" Value="7" />
|
|
||||||
<Setter Property="Height" Value="7" />
|
|
||||||
<Setter Property="Margin" Value="-2" />
|
|
||||||
<Setter Property="Fill">
|
|
||||||
<Setter.Value>
|
|
||||||
<RadialGradientBrush Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
|
|
||||||
<GradientStop Color="White" Offset="0.0" />
|
|
||||||
<GradientStop Color="Gray" Offset="0.8" />
|
|
||||||
</RadialGradientBrush>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!--ResizeDecorator Default Template-->
|
|
||||||
<ControlTemplate x:Key="ResizeDecoratorTemplate" TargetType="{x:Type Control}">
|
|
||||||
<Grid>
|
|
||||||
<Grid Opacity="0" Margin="-3">
|
|
||||||
<c:RotateThumb x:Name="rotate" Width="7"
|
|
||||||
Height="7"
|
|
||||||
Margin="0,-20,0,0"
|
|
||||||
Cursor="Hand"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Center"/>
|
|
||||||
<c:ResizeThumb Height="3"
|
|
||||||
Cursor="SizeNS"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Stretch"/>
|
|
||||||
<c:ResizeThumb Width="3"
|
|
||||||
Cursor="SizeWE"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="3"
|
|
||||||
Cursor="SizeWE"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalAlignment="Right"/>
|
|
||||||
<c:ResizeThumb Height="3"
|
|
||||||
Cursor="SizeNS"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Stretch"/>
|
|
||||||
<c:ResizeThumb Width="7"
|
|
||||||
Height="7"
|
|
||||||
Margin="-2"
|
|
||||||
Cursor="SizeNWSE"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="7"
|
|
||||||
Height="7"
|
|
||||||
Margin="-2"
|
|
||||||
Cursor="SizeNESW"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Right"/>
|
|
||||||
<c:ResizeThumb Width="7"
|
|
||||||
Height="7"
|
|
||||||
Margin="-2"
|
|
||||||
Cursor="SizeNESW"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Left"/>
|
|
||||||
<c:ResizeThumb Width="7"
|
|
||||||
Height="7"
|
|
||||||
Margin="-2"
|
|
||||||
Cursor="SizeNWSE"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Right"/>
|
|
||||||
</Grid>
|
|
||||||
<Grid IsHitTestVisible="False" Opacity="1" Margin="-3">
|
|
||||||
<Rectangle SnapsToDevicePixels="True"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Margin="1"
|
|
||||||
Stroke="Gray"/>
|
|
||||||
<Line x:Name="line" StrokeThickness="1" X1="0" Y1="0" X2="0" Y2="20"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
Margin="0,-19,0,0"
|
|
||||||
Stroke="Gray"/>
|
|
||||||
<Ellipse x:Name="top" Style="{StaticResource ThumbCorner}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-1,-20,0,0"/>
|
|
||||||
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
|
||||||
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
|
||||||
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
|
|
||||||
<Ellipse Style="{StaticResource ThumbCorner}" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<ControlTemplate.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ShowRotate}" Value="false">
|
|
||||||
<Setter TargetName="rotate" Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Setter TargetName="line" Property="Visibility" Value="Collapsed"/>
|
|
||||||
<Setter TargetName="top" Property="Visibility" Value="Collapsed"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</ControlTemplate.Triggers>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<ObjectDataProvider x:Key="ConnectorOrientationMenu" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
|
|
||||||
<ObjectDataProvider.MethodParameters>
|
|
||||||
<x:Type TypeName="dd:ConnectorOrientation" />
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
|
|
||||||
<Style x:Key="CinchMenuItemStyle" TargetType="{x:Type MenuItem}" >
|
|
||||||
<Setter Property="Header" Value="{Binding Text}" />
|
|
||||||
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
|
||||||
<Setter Property="Command" Value="{Binding Command}" />
|
|
||||||
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!-- Connector Style -->
|
|
||||||
<Style x:Key="PointConnectorStyle" TargetType="{x:Type dd:PointConnector}">
|
|
||||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
|
||||||
<Grid Width="{Binding ConnectorWidth}" Height="{Binding ConnectorHeight}">
|
|
||||||
<!-- transparent extra space makes connector easier to hit -->
|
|
||||||
<Ellipse Fill="Transparent" Margin="-3" />
|
|
||||||
<Ellipse Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" />
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ConnectorVertexType}" Value="Start">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
|
||||||
<Grid Width="{Binding ConnectorWidth}"
|
|
||||||
Height="{Binding ConnectorHeight}"
|
|
||||||
UseLayoutRounding="True"
|
|
||||||
SnapsToDevicePixels="True">
|
|
||||||
<Ellipse Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Margin="-2.5"/>
|
|
||||||
<Rectangle
|
|
||||||
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
|
||||||
Margin="1"/>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding ConnectorVertexType}" Value="End">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
|
||||||
<Grid Width="{Binding ConnectorWidth}"
|
|
||||||
Height="{Binding ConnectorHeight}"
|
|
||||||
UseLayoutRounding="True"
|
|
||||||
SnapsToDevicePixels="True">
|
|
||||||
<Ellipse Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Margin="-2.5"/>
|
|
||||||
<Ellipse
|
|
||||||
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
|
||||||
Margin="1"/>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Key="GifImageConnectorContainer" TargetType="{x:Type dd:ConnectorContainer}">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<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>
|
|
||||||
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<i:Interaction.Behaviors>
|
|
||||||
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddCommand}" />
|
|
||||||
</i:Interaction.Behaviors>
|
|
||||||
</Rectangle>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Key="ItemsControlStyle" TargetType="{x:Type ItemsControl}">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<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>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<ControlTemplate x:Key="ConnectorDecoratorTemplate"
|
|
||||||
TargetType="{x:Type Control}">
|
|
||||||
<Grid Margin="{Binding ConnectorMargin}">
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding LeftConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding TopLeftConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="TopLeft"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding TopConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Top"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding TopRightConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="TopRight"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding RightConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Right"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding BottomRightConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="BottomRight"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding BottomConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Bottom"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding BottomLeftConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="BottomLeft"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
|
||||||
<!--<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
|
||||||
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
|
||||||
</Button>
|
|
||||||
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
|
||||||
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
|
||||||
</Button>
|
|
||||||
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
|
||||||
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
|
||||||
</Button>
|
|
||||||
<Button Margin="-30" Background="Transparent" BorderThickness="0"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" >
|
|
||||||
<TextBlock Text="✚" FontWeight="Bold" FontSize="16" Foreground="DarkGray" />
|
|
||||||
</Button>-->
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<ControlTemplate x:Key="InnerConnectorDecoratorTemplate"
|
|
||||||
TargetType="{x:Type Control}">
|
|
||||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}">
|
|
||||||
<dd:ConnectorContainer.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid>
|
|
||||||
<dd:Connector
|
|
||||||
Content="{Binding .}"
|
|
||||||
SnapsToDevicePixels="True"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</dd:ConnectorContainer.ItemTemplate>
|
|
||||||
</dd:ConnectorContainer>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<ControlTemplate x:Key="BlockConnectorDecoratorTemplate"
|
|
||||||
TargetType="{x:Type Control}">
|
|
||||||
<Grid Margin="{Binding ConnectorMargin}">
|
|
||||||
<dd:BlockConnector
|
|
||||||
Content="{Binding LeftConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Left"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalAlignment="Left"/>
|
|
||||||
<dd:BlockConnector
|
|
||||||
Content="{Binding TopConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Top"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
HorizontalAlignment="Stretch"/>
|
|
||||||
<dd:BlockConnector
|
|
||||||
Content="{Binding RightConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Right"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalAlignment="Right"/>
|
|
||||||
<dd:BlockConnector
|
|
||||||
Content="{Binding BottomConnector}"
|
|
||||||
SnapsToDevicePixels="True"
|
|
||||||
Orientation="Bottom"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
HorizontalAlignment="Stretch"/>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<!--基础类型-->
|
|
||||||
<Style x:Key="designerItemStyle"
|
|
||||||
TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Left"
|
|
||||||
Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.Top"
|
|
||||||
Value="{Binding Top}" />
|
|
||||||
<Setter Property="Canvas.ZIndex"
|
|
||||||
Value="{Binding ZIndex}" />
|
|
||||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
|
||||||
Value="{Binding EnabledForSelection}" />
|
|
||||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
|
||||||
Value="{Binding EnabledForConnection}" />
|
|
||||||
<Setter Property="Visibility"
|
|
||||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="{Binding ItemWidth}" />
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="{Binding ItemHeight}" />
|
|
||||||
<Setter Property="MinWidth"
|
|
||||||
Value="{Binding MinItemWidth}" />
|
|
||||||
<Setter Property="MinHeight"
|
|
||||||
Value="{Binding MinItemHeight}" />
|
|
||||||
<Setter Property="SnapsToDevicePixels"
|
|
||||||
Value="True" />
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<ContextMenu.ItemContainerStyle>
|
|
||||||
<Style TargetType="MenuItem">
|
|
||||||
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
|
||||||
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
|
||||||
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
|
||||||
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
|
||||||
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
|
||||||
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
|
||||||
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
|
||||||
</Style>
|
|
||||||
</ContextMenu.ItemContainerStyle>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
|
|
||||||
<!-- PART_DragThumb -->
|
|
||||||
<c:DragThumb x:Name="PART_DragThumb"
|
|
||||||
Cursor="SizeAll" >
|
|
||||||
<c:DragThumb.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</c:DragThumb.InputBindings>
|
|
||||||
</c:DragThumb>
|
|
||||||
|
|
||||||
<Grid RenderTransformOrigin="0.5,0.5">
|
|
||||||
|
|
||||||
<!-- PART_ResizeDecorator -->
|
|
||||||
<Control x:Name="PART_ResizeDecorator"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- PART_ContentPresenter -->
|
|
||||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Content="{TemplateBinding Content}" />
|
|
||||||
|
|
||||||
<Control x:Name="PART_Text" Margin="1" IsHitTestVisible="{Binding IsReadOnlyText,Converter={StaticResource InvertBoolConverter}}">
|
|
||||||
<Control.Style>
|
|
||||||
<Style TargetType="Control">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate>
|
|
||||||
<Grid/>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ShowText}" Value="True">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate>
|
|
||||||
<dd:TextControl x:Name="PART_Text" />
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding Text,Converter={StaticResource NotNullOrEmptyToBoolConverter}}" Value="True">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate>
|
|
||||||
<dd:TextControl x:Name="PART_Text" />
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding CustomText}" Value="True">
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate>
|
|
||||||
<Grid/>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Control.Style>
|
|
||||||
</Control>
|
|
||||||
|
|
||||||
<!-- PART_ConnectorDecorator -->
|
|
||||||
<Control x:Name="PART_ConnectorDecorator" Template="{StaticResource ConnectorDecoratorTemplate}"/>
|
|
||||||
|
|
||||||
<Grid.RenderTransform>
|
|
||||||
<TransformGroup>
|
|
||||||
<RotateTransform Angle="{Binding Angle}" />
|
|
||||||
<ScaleTransform x:Name="scale" ScaleX="{Binding ScaleX}" ScaleY="{Binding ScaleY}"></ScaleTransform>
|
|
||||||
</TransformGroup>
|
|
||||||
</Grid.RenderTransform>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<MultiDataTrigger>
|
|
||||||
<MultiDataTrigger.Conditions>
|
|
||||||
<Condition Binding="{Binding IsSelected}" Value="True" />
|
|
||||||
<Condition Binding="{Binding ParentId}" Value="{x:Static sys:Guid.Empty}" />
|
|
||||||
</MultiDataTrigger.Conditions>
|
|
||||||
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
|
||||||
</MultiDataTrigger>
|
|
||||||
<MultiDataTrigger>
|
|
||||||
<MultiDataTrigger.Conditions>
|
|
||||||
<Condition Binding="{Binding IsSelected}" Value="True" />
|
|
||||||
<Condition Binding="{Binding AlwayForResized}" Value="True" />
|
|
||||||
</MultiDataTrigger.Conditions>
|
|
||||||
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
|
||||||
</MultiDataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding Connectors.Count}" Value="0">
|
|
||||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Collapsed" />
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding IsInnerConnector}" Value="True">
|
|
||||||
<Setter TargetName="PART_ConnectorDecorator" Property="Template" Value="{StaticResource InnerConnectorDecoratorTemplate}" />
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding SelectedDisable}" Value="True">
|
|
||||||
<Setter TargetName="selectedGrid" Property="IsHitTestVisible" Value="False" />
|
|
||||||
</DataTrigger>
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Effect">
|
|
||||||
<Setter.Value>
|
|
||||||
<DropShadowEffect BlurRadius="10" Color="{Binding ColorViewModel.ShadowColor}"/>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ColorViewModel.ShadowColor}" Value="Transparent">
|
|
||||||
<Setter Property="Effect" Value="{x:Null}"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!--连接线-->
|
|
||||||
<Style x:Key="connectorItemStyle"
|
|
||||||
TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="{Binding Area.Width}" />
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="{Binding Area.Height}" />
|
|
||||||
<Setter Property="Canvas.Top"
|
|
||||||
Value="{Binding Area.Top}" />
|
|
||||||
<Setter Property="Canvas.Left"
|
|
||||||
Value="{Binding Area.Left}" />
|
|
||||||
<Setter Property="Canvas.ZIndex"
|
|
||||||
Value="{Binding ZIndex}" />
|
|
||||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
|
||||||
Value="{Binding EnabledForSelection}" />
|
|
||||||
<Setter Property="Visibility"
|
|
||||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}">
|
|
||||||
<Grid.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</Grid.InputBindings>
|
|
||||||
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu x:Name="PART_ContextMenu">
|
|
||||||
<MenuItem Header="删除" Command="{Binding DeleteConnectionCommand}" CommandParameter="{Binding}"/>
|
|
||||||
<MenuItem Header="添加文本" Command="{Binding AddLabelCommand}" CommandParameter="{Binding}"/>
|
|
||||||
<MenuItem Header="插入点(按住ctrl可一直插入)" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" IsEnabled="{Binding IsReadOnly,Converter={dd:InvertBoolConverter}}" />
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
|
|
||||||
<dd:LineControl x:Name="line"/>
|
|
||||||
|
|
||||||
<!-- PART_DragThumb -->
|
|
||||||
<c:DragThumb x:Name="PART_DragThumb" Margin="{Binding DragThumbMargin}"
|
|
||||||
Cursor="SizeAll" >
|
|
||||||
<c:DragThumb.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</c:DragThumb.InputBindings>
|
|
||||||
</c:DragThumb>
|
|
||||||
|
|
||||||
<dd:PointContainer x:Name="PART_VerticesContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Vertices}" Visibility="Collapsed">
|
|
||||||
<dd:PointContainer.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid>
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Header="删除" Command="{Binding DeleteVertexCommand}" CommandParameter="{Binding}"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
<dd:PointConnector Style="{StaticResource PointConnectorStyle}"/>
|
|
||||||
<c:PointDragThumb Cursor="SizeAll" Opacity="0"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</dd:PointContainer.ItemTemplate>
|
|
||||||
<dd:PointContainer.Resources>
|
|
||||||
<Style TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
|
||||||
</Style>
|
|
||||||
</dd:PointContainer.Resources>
|
|
||||||
</dd:PointContainer>
|
|
||||||
|
|
||||||
<dd:PointContainer x:Name="PART_LabelsContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Labels}" >
|
|
||||||
<dd:PointContainer.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid dd:SelectionProps.EnabledForSelection="True" Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}">
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Header="删除" Command="{Binding DeleteLabelCommand}" CommandParameter="{Binding}"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
<c:PointDragThumb Cursor="SizeAll" Opacity="0">
|
|
||||||
<c:PointDragThumb.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</c:PointDragThumb.InputBindings>
|
|
||||||
</c:PointDragThumb>
|
|
||||||
<dd:TextControl Margin="5" />
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</dd:PointContainer.ItemTemplate>
|
|
||||||
<dd:PointContainer.Resources>
|
|
||||||
<Style TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
|
||||||
</Style>
|
|
||||||
</dd:PointContainer.Resources>
|
|
||||||
</dd:PointContainer>
|
|
||||||
|
|
||||||
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<i:Interaction.Behaviors>
|
|
||||||
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddVertexCommand}" />
|
|
||||||
</i:Interaction.Behaviors>
|
|
||||||
</Rectangle>
|
|
||||||
</Grid>
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsSelected}" Value="True">
|
|
||||||
<Setter TargetName="PART_VerticesContainer" Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
<DataTrigger Binding="{Binding ShouldInsertAnchor}" Value="True">
|
|
||||||
<Setter TargetName="PART_VerticesContainer" Property="Visibility" Value="Visible"/>
|
|
||||||
</DataTrigger>
|
|
||||||
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!--自带的Gif样式-->
|
|
||||||
<Style x:Key="gifimageItemStyle"
|
|
||||||
TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Top"
|
|
||||||
Value="{Binding Top}" />
|
|
||||||
<Setter Property="Canvas.Left"
|
|
||||||
Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.ZIndex"
|
|
||||||
Value="{Binding ZIndex}" />
|
|
||||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
|
||||||
Value="{Binding EnabledForSelection}" />
|
|
||||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
|
||||||
Value="{Binding EnabledForConnection}" />
|
|
||||||
<Setter Property="Visibility"
|
|
||||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="{Binding ItemWidth}" />
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="{Binding ItemHeight}" />
|
|
||||||
<Setter Property="SnapsToDevicePixels"
|
|
||||||
Value="True" />
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}">
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<MenuItem Header="插入点" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" />
|
|
||||||
<MenuItem Header="选择" ItemsSource="{Binding MenuOptions}" ItemContainerStyle="{StaticResource CinchMenuItemStyle}"/>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
<!-- PART_DragThumb -->
|
|
||||||
<c:DragThumb x:Name="PART_DragThumb"
|
|
||||||
Cursor="SizeAll" />
|
|
||||||
<Grid RenderTransformOrigin="0.5,0.5">
|
|
||||||
<!-- PART_ResizeDecorator -->
|
|
||||||
<Control x:Name="PART_ResizeDecorator"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
|
||||||
<!-- PART_ContentPresenter -->
|
|
||||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Content="{TemplateBinding Content}" />
|
|
||||||
<!-- PART_ConnectorDecorator -->
|
|
||||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Visibility="Hidden" Style="{StaticResource GifImageConnectorContainer}" ItemsSource="{Binding Connectors}">
|
|
||||||
<dd:ConnectorContainer.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<dd:Connector Content="{Binding .}" SnapsToDevicePixels="True"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</dd:ConnectorContainer.ItemTemplate>
|
|
||||||
</dd:ConnectorContainer>
|
|
||||||
<Grid.RenderTransform>
|
|
||||||
<TransformGroup>
|
|
||||||
<RotateTransform Angle="{Binding Angle}" />
|
|
||||||
<ScaleTransform x:Name="scale" ScaleX="{Binding ScaleX}" ScaleY="{Binding ScaleY}"></ScaleTransform>
|
|
||||||
</TransformGroup>
|
|
||||||
</Grid.RenderTransform>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<MultiDataTrigger>
|
|
||||||
<MultiDataTrigger.Conditions>
|
|
||||||
<Condition Binding="{Binding IsSelected}" Value="True" />
|
|
||||||
<Condition Binding="{Binding ParentId}" Value="{x:Static sys:Guid.Empty}" />
|
|
||||||
</MultiDataTrigger.Conditions>
|
|
||||||
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
|
||||||
</MultiDataTrigger>
|
|
||||||
<Trigger Property="IsMouseOver" Value="true">
|
|
||||||
<Setter TargetName="PART_ConnectorContainer" Property="Visibility" Value="Visible" />
|
|
||||||
</Trigger>
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!--自带的logical样式-->
|
|
||||||
<Style x:Key="logicalItemStyle"
|
|
||||||
TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Top"
|
|
||||||
Value="{Binding Top}" />
|
|
||||||
<Setter Property="Canvas.Left"
|
|
||||||
Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.ZIndex"
|
|
||||||
Value="{Binding ZIndex}" />
|
|
||||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
|
||||||
Value="{Binding EnabledForSelection}" />
|
|
||||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
|
||||||
Value="{Binding EnabledForConnection}" />
|
|
||||||
<Setter Property="Visibility"
|
|
||||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="{Binding ItemWidth}" />
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="{Binding ItemHeight}" />
|
|
||||||
<Setter Property="SnapsToDevicePixels"
|
|
||||||
Value="True" />
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid x:Name="selectedGrid">
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<ContextMenu.ItemContainerStyle>
|
|
||||||
<Style TargetType="MenuItem">
|
|
||||||
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
|
||||||
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
|
||||||
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
|
||||||
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
|
||||||
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
|
||||||
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
|
||||||
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
|
||||||
</Style>
|
|
||||||
</ContextMenu.ItemContainerStyle>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
|
|
||||||
<!--PART_ConnectorDecorator-->
|
|
||||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Margin="0,0,0,0">
|
|
||||||
<dd:ConnectorContainer.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid>
|
|
||||||
<dd:Connector Content="{Binding .}" SnapsToDevicePixels="True"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</dd:ConnectorContainer.ItemTemplate>
|
|
||||||
</dd:ConnectorContainer>
|
|
||||||
<!-- PART_DragThumb -->
|
|
||||||
<c:DragThumb x:Name="PART_DragThumb"
|
|
||||||
Cursor="SizeAll" >
|
|
||||||
<c:DragThumb.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</c:DragThumb.InputBindings>
|
|
||||||
</c:DragThumb>
|
|
||||||
<!-- PART_ResizeDecorator -->
|
|
||||||
<Control x:Name="PART_ResizeDecorator"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
Template="{StaticResource ResizeDecoratorTemplate}"/>
|
|
||||||
<!-- PART_ContentPresenter -->
|
|
||||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Content="{TemplateBinding Content}" />
|
|
||||||
</Grid>
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<MultiDataTrigger>
|
|
||||||
<MultiDataTrigger.Conditions>
|
|
||||||
<Condition Value="True" Binding="{Binding IsSelected}"/>
|
|
||||||
<Condition Value="{x:Static sys:Guid.Empty}" Binding="{Binding ParentId}"/>
|
|
||||||
</MultiDataTrigger.Conditions>
|
|
||||||
<Setter TargetName="PART_ResizeDecorator" Property="Visibility" Value="Visible"/>
|
|
||||||
</MultiDataTrigger>
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!--自带的block基础类型-->
|
|
||||||
<Style x:Key="blockItemStyle"
|
|
||||||
TargetType="{x:Type ContentPresenter}">
|
|
||||||
<Setter Property="Canvas.Left"
|
|
||||||
Value="{Binding Left}" />
|
|
||||||
<Setter Property="Canvas.Top"
|
|
||||||
Value="{Binding Top}" />
|
|
||||||
<Setter Property="Canvas.ZIndex"
|
|
||||||
Value="{Binding ZIndex}" />
|
|
||||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
|
||||||
Value="{Binding EnabledForSelection}" />
|
|
||||||
<Setter Property="Visibility"
|
|
||||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
|
||||||
<Setter Property="Width"
|
|
||||||
Value="{Binding ItemWidth}" />
|
|
||||||
<Setter Property="Height"
|
|
||||||
Value="{Binding ItemHeight}" />
|
|
||||||
<Setter Property="MinWidth"
|
|
||||||
Value="{Binding MinItemWidth}" />
|
|
||||||
<Setter Property="MinHeight"
|
|
||||||
Value="{Binding MinItemHeight}" />
|
|
||||||
<Setter Property="SnapsToDevicePixels"
|
|
||||||
Value="True" />
|
|
||||||
<Setter Property="dd:WidthAndHeightProps.Active"
|
|
||||||
Value="true" />
|
|
||||||
<Setter Property="dd:WidthAndHeightProps.BoundActualWidth"
|
|
||||||
Value="{Binding ActualItemWidth,Mode=OneWayToSource}" />
|
|
||||||
<Setter Property="dd:WidthAndHeightProps.BoundActualHeight"
|
|
||||||
Value="{Binding ActualItemHeight,Mode=OneWayToSource}" />
|
|
||||||
<Setter Property="ContentTemplate">
|
|
||||||
<Setter.Value>
|
|
||||||
<DataTemplate>
|
|
||||||
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
|
|
||||||
<Grid.ContextMenu>
|
|
||||||
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
|
|
||||||
<ContextMenu.ItemContainerStyle>
|
|
||||||
<Style TargetType="MenuItem">
|
|
||||||
<Setter Property="MenuItem.Header" Value="{Binding Text}" />
|
|
||||||
<Setter Property="MenuItem.ItemsSource" Value="{Binding Children}" />
|
|
||||||
<Setter Property="MenuItem.Command" Value="{Binding Command}" />
|
|
||||||
<Setter Property="MenuItem.Icon" Value="{Binding Icon}" />
|
|
||||||
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
|
|
||||||
<Setter Property="MenuItem.IsCheckable" Value="{Binding IsCheckable}" />
|
|
||||||
<Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
|
|
||||||
</Style>
|
|
||||||
</ContextMenu.ItemContainerStyle>
|
|
||||||
</ContextMenu>
|
|
||||||
</Grid.ContextMenu>
|
|
||||||
|
|
||||||
<!-- PART_DragThumb -->
|
|
||||||
<c:DragThumb x:Name="PART_DragThumb"
|
|
||||||
Cursor="SizeAll" >
|
|
||||||
<c:DragThumb.InputBindings>
|
|
||||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
|
||||||
</c:DragThumb.InputBindings>
|
|
||||||
</c:DragThumb>
|
|
||||||
|
|
||||||
<Grid RenderTransformOrigin="0.5,0.5" >
|
|
||||||
<!-- PART_ContentPresenter -->
|
|
||||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Content="{TemplateBinding Content}" />
|
|
||||||
|
|
||||||
<!-- PART_ConnectorDecorator -->
|
|
||||||
<Control x:Name="PART_ConnectorDecorator" Template="{StaticResource BlockConnectorDecoratorTemplate}"/>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding Connectors.Count}" Value="0">
|
|
||||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Collapsed" />
|
|
||||||
</DataTrigger>
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Effect">
|
|
||||||
<Setter.Value>
|
|
||||||
<DropShadowEffect BlurRadius="10" Color="{Binding ColorViewModel.ShadowColor}"/>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding ColorViewModel.ShadowColor}" Value="Transparent">
|
|
||||||
<Setter Property="Effect" Value="{x:Null}"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Control x:Name="control">
|
<Control x:Name="control">
|
||||||
|
|||||||
Reference in New Issue
Block a user