mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-08 18:26:35 +08:00
mind
This commit is contained in:
44
AIStudio.Wpf.Mind/Controls/MindEditor.xaml
Normal file
44
AIStudio.Wpf.Mind/Controls/MindEditor.xaml
Normal file
@@ -0,0 +1,44 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.Mind.Controls"
|
||||
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Themes/MindNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ComboBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="AIStudio.Styles.MindEditor" TargetType="{x:Type controls:MindEditor}">
|
||||
<Setter Property="Focusable" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:MindEditor}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- ToolBox Control -->
|
||||
<ContentControl Template="{Binding ToolBox,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||
|
||||
<ScrollViewer Grid.Column="1">
|
||||
<!-- Diagram Control -->
|
||||
<dd:DiagramControl x:Name="PART_DiagramControl" MinWidth="1000" MinHeight="1000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="AIStudio.Styles.MindEditor.Default" TargetType="{x:Type controls:MindEditor}" BasedOn="{StaticResource AIStudio.Styles.MindEditor}">
|
||||
<Setter Property="ToolBox">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Control">
|
||||
<controls:ToolBoxControl />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:MindEditor}" BasedOn="{StaticResource AIStudio.Styles.MindEditor.Default}" />
|
||||
</ResourceDictionary>
|
||||
@@ -159,6 +159,26 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
}
|
||||
}
|
||||
|
||||
#region ToolBox
|
||||
/// <summary>
|
||||
/// 附加组件模板
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ToolBoxProperty = DependencyProperty.Register(
|
||||
nameof(ToolBox), typeof(ControlTemplate), typeof(MindEditor), new FrameworkPropertyMetadata(default(ControlTemplate)));
|
||||
|
||||
public ControlTemplate ToolBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ControlTemplate)GetValue(ToolBoxProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ToolBoxProperty, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SelectedObject
|
||||
|
||||
public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register(nameof(SelectedObject), typeof(object), typeof(MindEditor), new UIPropertyMetadata(default(object)));
|
||||
37
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
Normal file
37
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
Normal file
@@ -0,0 +1,37 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.Mind.Controls.ToolBoxControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.Mind.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800" >
|
||||
<Grid Height="60">
|
||||
<TabControl>
|
||||
<TabItem Header="思路">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="外观">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="视图">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
26
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml.cs
Normal file
26
AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// ToolBoxControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ToolBoxControl : UserControl
|
||||
{
|
||||
public ToolBoxControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user