mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
连接点可以添加文字
This commit is contained in:
@@ -18,14 +18,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
/// </summary>
|
||||
public partial class TextControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||
"DoubleEdit", typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(
|
||||
public static readonly DependencyProperty DoubleEditProperty = DependencyProperty.Register(
|
||||
nameof(DoubleEdit), typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(
|
||||
true));
|
||||
|
||||
public bool DoubleEdit
|
||||
{
|
||||
get => (bool)GetValue(TextProperty);
|
||||
set => SetValue(TextProperty, value);
|
||||
get => (bool)GetValue(DoubleEditProperty);
|
||||
set => SetValue(DoubleEditProperty, value);
|
||||
}
|
||||
|
||||
public TextControl()
|
||||
@@ -48,7 +48,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
|
||||
}
|
||||
|
||||
(this.DataContext as SelectableDesignerItemViewModelBase).PropertyChanged += TextControl_PropertyChanged;
|
||||
if (this.DataContext is ISelectable selectable)
|
||||
{
|
||||
selectable.PropertyChanged += TextControl_PropertyChanged;
|
||||
}
|
||||
TextControl_PropertyChanged(this.DataContext, new System.ComponentModel.PropertyChangedEventArgs("IsSelected"));
|
||||
}
|
||||
|
||||
@@ -56,9 +59,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (e.PropertyName == "IsSelected")
|
||||
{
|
||||
if (sender is SelectableDesignerItemViewModelBase itemViewModelBase)
|
||||
if (sender is ISelectable selectable)
|
||||
{
|
||||
if (itemViewModelBase.IsSelected == false)
|
||||
if (selectable.IsSelected == false)
|
||||
{
|
||||
PART_ShowText.Visibility = Visibility.Collapsed;
|
||||
PART_TextBlock.Visibility = Visibility.Visible;
|
||||
|
||||
Reference in New Issue
Block a user