可以自定义连接点

This commit is contained in:
艾竹
2023-01-29 22:54:06 +08:00
parent ba9e3bdf58
commit 5ee0c1ce26
15 changed files with 548 additions and 125 deletions

View File

@@ -43,6 +43,7 @@ namespace AIStudio.Wpf.DiagramDesigner
ConnectorHeight = 30;
DeleteLabelCommand = new SimpleCommand(Command_Enable, DeleteLabel);
EditCommand = new SimpleCommand(Command_Enable, ExecuteEditCommand);
}
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
@@ -81,7 +82,7 @@ namespace AIStudio.Wpf.DiagramDesigner
get; set;
}
//private bool _isSelected;
private bool _isSelected;
public override bool IsSelected
{
get
@@ -106,6 +107,11 @@ namespace AIStudio.Wpf.DiagramDesigner
{
get; set;
}
public SimpleCommand EditCommand
{
get; private set;
}
#endregion
private bool updating = false;
@@ -198,5 +204,11 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
protected virtual void ExecuteEditCommand(object param)
{
if (IsReadOnly == true) return;
RaisePropertyChanged("ShowText");
}
}
}

View File

@@ -297,7 +297,8 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
public virtual bool CanAttachTo(FullyCreatedConnectorInfo port) => port != this && !port.IsReadOnly && DataItem != port.DataItem;
public virtual bool CanAttachTo(FullyCreatedConnectorInfo port)
=> port != this && !port.IsReadOnly && DataItem != port.DataItem;
}

View File

@@ -118,13 +118,7 @@ namespace AIStudio.Wpf.DiagramDesigner
}
set
{
if (SetProperty(ref _text, value))
{
if (!string.IsNullOrEmpty(_text))
{
ShowText = true;
}
}
SetProperty(ref _text, value);
}
}
@@ -152,7 +146,10 @@ namespace AIStudio.Wpf.DiagramDesigner
}
set
{
SetProperty(ref _showText, value);
if (!SetProperty(ref _showText, value))
{
RaisePropertyChanged(nameof(ShowText));
}
}
}
@@ -191,8 +188,6 @@ namespace AIStudio.Wpf.DiagramDesigner
if (IsReadOnly == true) return;
ShowText = true;
RaisePropertyChanged("EditText");
}
}
}

View File

@@ -144,7 +144,7 @@ namespace AIStudio.Wpf.DiagramDesigner
get; set;
}
protected bool _isSelected;
private bool _isSelected;
[Browsable(false)]
public virtual bool IsSelected
{