最近精简代码,有些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

@@ -315,7 +315,7 @@
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
<Grid x:Name="selectedGrid" IsHitTestVisible="{Binding IsHitTestVisible}" >
<Grid.ContextMenu>
<ContextMenu ItemsSource="{Binding MenuOptions}" Visibility="{Binding ShowMenuOptions,Converter={StaticResource BooleanToVisibilityConverter}}">
<ContextMenu.ItemContainerStyle>
@@ -462,8 +462,8 @@
Value="{Binding Area.Left}" />
<Setter Property="Canvas.ZIndex"
Value="{Binding ZIndex}" />
<!--<Setter Property="dd:SelectionProps.EnabledForSelection"
Value="{Binding EnabledForSelection}" />-->
<Setter Property="dd:SelectionProps.EnabledForSelection"
Value="{Binding EnabledForSelection}" />
<Setter Property="Visibility"
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Setter Property="ContentTemplate">
@@ -860,7 +860,8 @@
<ScrollViewer Name="DesignerScrollViewer"
Background="Transparent"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
VerticalScrollBarVisibility="Auto"
Focusable="False">
<ItemsControl x:Name="diagram" ItemsSource="{Binding Items}"
ItemContainerStyleSelector="{x:Static dd:DesignerItemsControlItemStyleSelector.Instance}">
<ItemsControl.ItemsPanel>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
namespace AIStudio.Wpf.DiagramDesigner
{
public class GridControl : Grid
{
public IDiagramViewModel DiagramViewModel
{
get
{
return (this.DataContext as SelectableDesignerItemViewModelBase)?.Root;
}
}
//protected override void OnPreviewKeyDown(KeyEventArgs e)
//{
// base.OnPreviewKeyDown(e);
// e.Handled = DiagramViewModel?.ExecuteShortcut(e) ?? false;
//}
}
}

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;
}
}
}
}
}