最近精简代码,有些bug,修复

This commit is contained in:
艾竹
2023-04-08 14:22:12 +08:00
parent 347488e8e9
commit 78da8f4852
15 changed files with 193 additions and 199 deletions

View File

@@ -59,9 +59,9 @@ namespace AIStudio.Wpf.DiagramDesigner
private void TextControl_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsSelected")
if (sender is ISelectable selectable)
{
if (sender is ISelectable selectable)
if (e.PropertyName == "IsSelected")
{
if (selectable.IsSelected == false)
{
@@ -70,16 +70,16 @@ namespace AIStudio.Wpf.DiagramDesigner
selectable.IsEditing = false;
}
}
}
else if (e.PropertyName == "ShowText")
{
PART_ShowText.Visibility = Visibility.Visible;
PART_TextBlock.Visibility = Visibility.Collapsed;
PART_ShowText.Focus();
if (!string.IsNullOrEmpty(PART_ShowText.Text))
else if (e.PropertyName == "ShowText")
{
PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
}
PART_ShowText.Visibility = Visibility.Visible;
PART_TextBlock.Visibility = Visibility.Collapsed;
PART_ShowText.Focus();
if (!string.IsNullOrEmpty(PART_ShowText.Text))
{
PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
}
}
}
}
}