mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 00:37:19 +08:00
最近精简代码,有些bug,修复
This commit is contained in:
@@ -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>
|
||||
|
||||
28
AIStudio.Wpf.DiagramDesigner/UserControls/GridControl.cs
Normal file
28
AIStudio.Wpf.DiagramDesigner/UserControls/GridControl.cs
Normal 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;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user