mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-08 10:16:36 +08:00
查找与替换完成
This commit is contained in:
@@ -199,6 +199,15 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
_service.PropertyChanged += _service_PropertyChanged;
|
||||
this.Loaded += DesignerCanvas_Loaded;
|
||||
this.IsVisibleChanged += DesignerCanvas_IsVisibleChanged;
|
||||
}
|
||||
|
||||
private void DesignerCanvas_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
this.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void DesignerCanvas_Loaded(object sender, RoutedEventArgs e)
|
||||
@@ -354,8 +363,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
//var focusedElement = Keyboard.FocusedElement;
|
||||
//Debug.WriteLine("focusedElement:" + focusedElement?.ToString());
|
||||
var focusedElement = Keyboard.FocusedElement;
|
||||
Debug.WriteLine("focusedElement:" + focusedElement?.ToString());
|
||||
|
||||
base.OnMouseMove(e);
|
||||
|
||||
|
||||
46
AIStudio.Wpf.DiagramDesigner/Controls/MyTabControl.cs
Normal file
46
AIStudio.Wpf.DiagramDesigner/Controls/MyTabControl.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Controls
|
||||
{
|
||||
public class DiagramTabControl : TabControl
|
||||
{
|
||||
public DiagramTabControl()
|
||||
{
|
||||
// Attach event handler to TabControl.SelectionChanged event
|
||||
this.SelectionChanged += DiagramTabControl_SelectionChanged;
|
||||
this.IsVisibleChanged += DiagramTabControl_IsVisibleChanged;
|
||||
}
|
||||
|
||||
private void DiagramTabControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
foreach (var item in this.Items)
|
||||
{
|
||||
if (item is DiagramViewModel viewModel)
|
||||
{
|
||||
viewModel.ShowSearch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DiagramTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Iterate through all TabItems and manually set the Visibility property
|
||||
foreach (var item in this.Items)
|
||||
{
|
||||
if (item is DiagramViewModel viewModel)
|
||||
{
|
||||
if (item != this.SelectedItem)
|
||||
{
|
||||
viewModel.ShowSearch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user