mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
mind 工具栏
This commit is contained in:
@@ -426,10 +426,6 @@
|
||||
Value="true">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
<DataTrigger Value="True"
|
||||
Binding="{Binding RelativeSource={RelativeSource Self},Path=IsDragConnectionOver}">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Value="0"
|
||||
Binding="{Binding Connectors.Count}">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Collapsed" />
|
||||
@@ -466,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">
|
||||
@@ -641,9 +637,6 @@
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="PART_ConnectorContainer" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<DataTrigger Value="True" Binding="{Binding IsDragConnectionOver}">
|
||||
<Setter TargetName="PART_ConnectorContainer" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
@@ -768,10 +761,6 @@
|
||||
Value="true">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
<DataTrigger Value="True" Binding="{Binding RelativeSource={RelativeSource Self},Path=IsDragConnectionOver}">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
@@ -822,9 +811,6 @@
|
||||
Value="true">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
<DataTrigger Value="True" Binding="{Binding RelativeSource={RelativeSource Self},Path=IsDragConnectionOver}">
|
||||
<Setter TargetName="PART_ConnectorDecorator" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
FontCase = FontCase.None;
|
||||
HorizontalAlignment = HorizontalAlignment.Center;
|
||||
VerticalAlignment = VerticalAlignment.Center;
|
||||
LineHeight = 0;
|
||||
LineHeight = Double.NaN;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -458,7 +458,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private double _lineHeight;
|
||||
private double _lineHeight = Double.NaN;
|
||||
public double LineHeight
|
||||
{
|
||||
get
|
||||
|
||||
@@ -7,35 +7,34 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/ColorCanvas.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Geometry x:Key="DownArrowGeometry">M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z</Geometry>
|
||||
<Geometry x:Key="DownArrowGeometry">M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z</Geometry>
|
||||
|
||||
<Style x:Key="ColorPickerToggleButtonStyle" TargetType="ToggleButton">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
|
||||
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Border>
|
||||
|
||||
<Grid x:Name="arrowGlyph" Grid.Column="1" Margin="5">
|
||||
|
||||
<Grid x:Name="arrowGlyph" Grid.Column="1">
|
||||
<Path x:Name="Arrow"
|
||||
Width="9"
|
||||
Height="5"
|
||||
Height="6"
|
||||
Margin="0 0 3 0"
|
||||
Stretch="Fill"
|
||||
Data="{StaticResource DownArrowGeometry}"
|
||||
Fill="#FF000000"
|
||||
Margin="0,1,0,0"/>
|
||||
Fill="#FF000000"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -113,12 +112,6 @@
|
||||
<Setter TargetName="_outerBorder" Property="BorderBrush" Value="#FFFF0000" />
|
||||
<Setter TargetName="_innerBorder" Property="BorderBrush" Value="#FFFFFF00" />
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding DisplayColorAndName, RelativeSource={RelativeSource AncestorType={x:Type controls:ColorPicker}}}"
|
||||
Value="False">
|
||||
<Setter Property="ToolTip"
|
||||
Value="{x:Static sys:String.Empty}"
|
||||
TargetName="mainGrid" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -196,11 +189,9 @@
|
||||
<ContentPresenter x:Name="contentPresenter"
|
||||
ContentSource="Header"
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiDataTrigger>
|
||||
@@ -224,45 +215,37 @@
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="Gray" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="MaxDropDownWidth" Value="218" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||||
<Setter Property="Padding" Value="3,0" />
|
||||
<Setter Property="DisplayColorAndName" Value="True"/>
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:ColorPicker}">
|
||||
<Grid x:Name="PART_Root">
|
||||
<Border x:Name="Bg" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
CornerRadius="3"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"/>
|
||||
|
||||
<Grid x:Name="PART_InnerGrid" Margin="{TemplateBinding Padding}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="0" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid>
|
||||
<ContentControl x:Name="ColorOnly" Style="{StaticResource ColorDisplayStyle}" />
|
||||
|
||||
<Border x:Name="ColorAndName" Background="White" Visibility="Hidden">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ContentControl HorizontalAlignment="Left" Width="20" Margin="2,1,4,1" Style="{StaticResource ColorDisplayStyle}" BorderThickness="1" BorderBrush="#FFC9CACA" />
|
||||
<TextBlock Text="{Binding SelectedColorText, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!--下拉按钮-->
|
||||
<ToggleButton x:Name="PART_ColorPickerToggleButton" Panel.ZIndex="1" IsTabStop="False" Style="{StaticResource ColorPickerToggleButtonStyle}"
|
||||
<ToggleButton x:Name="PART_ColorPickerToggleButton" Panel.ZIndex="1" IsTabStop="False"
|
||||
Style="{StaticResource ColorPickerToggleButtonStyle}"
|
||||
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
Grid.Column="0" Grid.ColumnSpan="2" Margin="0"
|
||||
Foreground="{TemplateBinding BorderBrush}"/>
|
||||
Foreground="{TemplateBinding BorderBrush}">
|
||||
<!--<ContentControl x:Name="ColorOnly" Style="{StaticResource ColorDisplayStyle}" />-->
|
||||
<ContentControl x:Name="ColorOnly"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{Binding Content, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
UseLayoutRounding="False" Margin="0,0,0,0" />
|
||||
</ToggleButton>
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -365,11 +348,6 @@
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="DisplayColorAndName" Value="True">
|
||||
<Setter TargetName="ColorOnly" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ColorAndName" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="ShowTabHeaders"
|
||||
Value="False">
|
||||
<Setter Property="Visibility"
|
||||
|
||||
@@ -151,23 +151,6 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
|
||||
#endregion //ButtonStyle
|
||||
|
||||
#region DisplayColorAndName
|
||||
|
||||
public static readonly DependencyProperty DisplayColorAndNameProperty = DependencyProperty.Register("DisplayColorAndName", typeof(bool), typeof(ColorPicker), new UIPropertyMetadata(false));
|
||||
public bool DisplayColorAndName
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)GetValue(DisplayColorAndNameProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(DisplayColorAndNameProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion //DisplayColorAndName
|
||||
|
||||
#region ColorMode
|
||||
|
||||
public static readonly DependencyProperty ColorModeProperty = DependencyProperty.Register("ColorMode", typeof(ColorMode), typeof(ColorPicker), new UIPropertyMetadata(ColorMode.ColorPalette));
|
||||
@@ -530,6 +513,21 @@ namespace AIStudio.Wpf.Mind.Controls
|
||||
|
||||
#endregion //UsingAlphaChannel
|
||||
|
||||
/// <summary>Identifies the <see cref="Content"/> dependency property.</summary>
|
||||
public static readonly DependencyProperty ContentProperty
|
||||
= DependencyProperty.Register(nameof(Content),
|
||||
typeof(object),
|
||||
typeof(ColorPicker));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content of this control.
|
||||
/// </summary>
|
||||
public object Content
|
||||
{
|
||||
get => (object)this.GetValue(ContentProperty);
|
||||
set => this.SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
#endregion //Properties
|
||||
|
||||
#region Constructors
|
||||
|
||||
40
AIStudio.Wpf.Mind/Controls/OpenFileTextBox.xaml
Normal file
40
AIStudio.Wpf.Mind/Controls/OpenFileTextBox.xaml
Normal file
@@ -0,0 +1,40 @@
|
||||
<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">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Styles/Button.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="OpenFileTextBoxStyle" TargetType="{x:Type controls:OpenFileTextBox}">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="Gray" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:OpenFileTextBox}">
|
||||
<Grid x:Name="RootGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border x:Name="Bg"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
Grid.ColumnSpan="2"/>
|
||||
|
||||
<!--内容区域-->
|
||||
<ScrollViewer x:Name="PART_ContentHost" BorderThickness="0" IsTabStop="False" Margin="2"
|
||||
VerticalAlignment="Stretch" Background="{x:Null}" />
|
||||
<Button x:Name="PART_OpenButton" Grid.Column="1" Content="打开" Padding="6,0" Style="{StaticResource FlatButtonStyle}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:OpenFileTextBox}" BasedOn="{StaticResource OpenFileTextBoxStyle}" />
|
||||
|
||||
</ResourceDictionary>
|
||||
65
AIStudio.Wpf.Mind/Controls/OpenFileTextBox.xaml.cs
Normal file
65
AIStudio.Wpf.Mind/Controls/OpenFileTextBox.xaml.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.Controls
|
||||
{
|
||||
[TemplatePart(Name = PART_OpenButton, Type = typeof(Button))]
|
||||
public class OpenFileTextBox : TextBox
|
||||
{
|
||||
private const string PART_OpenButton = "PART_OpenButton";
|
||||
private Button _openButton;
|
||||
|
||||
static OpenFileTextBox()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(OpenFileTextBox), new FrameworkPropertyMetadata(typeof(OpenFileTextBox)));
|
||||
}
|
||||
|
||||
/// <summary>Identifies the <see cref="Filter"/> dependency property.</summary>
|
||||
public static readonly DependencyProperty FilterProperty
|
||||
= DependencyProperty.Register(nameof(Filter), typeof(string), typeof(OpenFileTextBox), new UIPropertyMetadata("图像文件(*.bmp, *.jpg)|*.bmp;*.jpg|所有文件(*.*)|*.*"));
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the "popup" menu for this control is currently open
|
||||
/// </summary>
|
||||
public string Filter
|
||||
{
|
||||
get => (string)this.GetValue(FilterProperty);
|
||||
set => this.SetValue(FilterProperty, (string)value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
if (_openButton != null)
|
||||
{
|
||||
_openButton.Click -= _openButton_Click;
|
||||
}
|
||||
|
||||
_openButton = this.Template.FindName(PART_OpenButton, this) as Button;
|
||||
|
||||
if (_openButton != null)
|
||||
{
|
||||
_openButton.Click += _openButton_Click;
|
||||
}
|
||||
}
|
||||
|
||||
private void _openButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog fd = new OpenFileDialog();
|
||||
fd.Title = "请选择文件";
|
||||
fd.Filter = Filter;
|
||||
fd.FileName = Text?.Trim();
|
||||
if (fd.ShowDialog() == true)
|
||||
{
|
||||
SetValue(TextProperty, fd.FileName);
|
||||
}
|
||||
//this.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,11 +122,11 @@
|
||||
<controls:DropDownButton.Items>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="链接地址:"></TextBlock>
|
||||
<TextBox x:Name="link" Width="300" Text="{Binding SelectedItem.LinkInfo.Link}"/>
|
||||
<TextBox x:Name="link" Width="300" Height="50" Text="{Binding SelectedItem.LinkInfo.Link}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="提示文本:"></TextBlock>
|
||||
<TextBox x:Name="linktext" Width="300" Text="{Binding SelectedItem.LinkInfo.Text}"/>
|
||||
<TextBox x:Name="linktext" Width="300" Height="50" Text="{Binding SelectedItem.LinkInfo.Text}"/>
|
||||
</StackPanel>
|
||||
<MenuItem Header="插入链接" Command="{Binding AddLinkCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
@@ -149,11 +149,11 @@
|
||||
<controls:DropDownButton.Items>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="文件地址:"></TextBlock>
|
||||
<TextBox x:Name="imageurl" Width="300" Text="{Binding SelectedItem.ImageInfo.Url}"/>
|
||||
<TextBox x:Name="imageurl" Width="300" Height="50" Text="{Binding SelectedItem.ImageInfo.Url}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="提示文本:"></TextBlock>
|
||||
<TextBox x:Name="imagetext" Width="300" Text="{Binding SelectedItem.ImageInfo.Text}"/>
|
||||
<TextBox x:Name="imagetext" Width="300" Height="50" Text="{Binding SelectedItem.ImageInfo.Text}"/>
|
||||
</StackPanel>
|
||||
<MenuItem Header="插入图片" Command="{Binding AddImageCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
@@ -174,7 +174,8 @@
|
||||
</StackPanel>
|
||||
</controls:DropDownButton.Content>
|
||||
<controls:DropDownButton.Items>
|
||||
<MenuItem Header="插入备注" Command="{Binding AddRemarkCommand}"></MenuItem>
|
||||
<TextBox x:Name="remark" Width="300" Height="50" Text="{Binding SelectedItem.Remark}"/>
|
||||
<MenuItem Header="插入备注" Command="{Binding AddRemarkCommand}" CommandParameter="{Binding ElementName=remark,Path=Text}"></MenuItem>
|
||||
<MenuItem Header="移除已有备注" Command="{Binding RemoveRemarkCommand}"></MenuItem>
|
||||
</controls:DropDownButton.Items>
|
||||
</controls:DropDownButton>
|
||||
@@ -488,19 +489,19 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.RowSpan="2" Style="{StaticResource FlatButtonStyle}" >
|
||||
<Button Grid.RowSpan="2" Style="{StaticResource FlatButtonStyle}" Command="{Binding ClearThemeCommand}">
|
||||
<StackPanel>
|
||||
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M719.329882 422.249412l-255.578353 255.578353 234.315295 234.315294 255.518117-255.638588-234.315294-234.255059zM59.151059 315.813647l298.164706-298.164706a60.235294 60.235294 0 0 1 85.172706 0l596.329411 596.329412a60.235294 60.235294 0 0 1 0 85.172706l-298.164706 298.164706a60.235294 60.235294 0 0 1-85.232941 0l-596.329411-596.329412a60.235294 60.235294 0 0 1 0-85.172706z"></Path>
|
||||
<TextBlock>清除样式</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="1" Style="{StaticResource FlatButtonStyle}" >
|
||||
<Button Grid.Column="1" Style="{StaticResource FlatButtonStyle}" Command="{Binding CopyThemeCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M701.248 177.6l175.104-113.024 83.456 114.88-131.136 162.304-127.424-164.16z m-133.376-61.568c51.264 6.976 300.608 346.624 294.272 384.704s-145.536 143.68-145.536 143.68L400.64 238.592s116.032-129.6 167.232-122.56zM370.368 288.448l305.024 396.672-187.136 272L65.664 359.04s83.776-3.84 153.536-24.32c45.632-13.504 151.232-46.272 151.168-46.272z"></Path>
|
||||
<TextBlock>复制样式</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="1" Grid.Row="1" Style="{StaticResource FlatButtonStyle}" >
|
||||
<Button Grid.Column="1" Grid.Row="1" Style="{StaticResource FlatButtonStyle}" Command="{Binding PasteThemeCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M411.880727 905.169455v-279.272728h149.876364v279.272728z m54.272-279.645091v-124.881455h412.904728V325.771636h-64.605091v116.363637h-698.181819v-279.272728h698.181819v116.363637h111.104v268.055273h-412.904728v78.289454z"></Path>
|
||||
<TextBlock>粘贴样式</TextBlock>
|
||||
@@ -515,8 +516,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox x:Name="comboBoxFontName"
|
||||
MinWidth="40"
|
||||
Height="22"
|
||||
Width="80"
|
||||
BorderBrush="Gainsboro"
|
||||
IsTextSearchEnabled="True"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
@@ -530,9 +530,8 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="comboBoxFontSize"
|
||||
Width="49"
|
||||
Width="50"
|
||||
HorizontalAlignment="Left"
|
||||
Height="22"
|
||||
BorderBrush="Gainsboro"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding SelectedItem.FontViewModel.FontSizes}"
|
||||
@@ -553,8 +552,45 @@
|
||||
IsChecked="{Binding SelectedItem.FontViewModel.FontStyle,Converter={dd:ConverterValueMapToBool Parameter='Normal'}, ConverterParameter='Italic'}">
|
||||
<Path Stretch="Uniform" Margin="2" Fill="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" Data="M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"></Path>
|
||||
</ToggleButton>
|
||||
<controls:ColorPicker SelectedColor="{Binding SelectedItem.FontViewModel.FontColor}"/>
|
||||
<controls:ColorPicker SelectedColor="{Binding SelectedItem.ColorViewModel.FillColor.Color}"/>
|
||||
<controls:ColorPicker SelectedColor="{Binding SelectedItem.FontViewModel.FontColor}">
|
||||
<controls:ColorPicker.Content>
|
||||
<Grid>
|
||||
<Rectangle VerticalAlignment="Bottom"
|
||||
Height="4"
|
||||
Width="14"
|
||||
HorizontalAlignment="Center">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding SelectedItem.FontViewModel.FontColor}" />
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Path Width="14" Height="14" Stretch="Uniform" RenderTransformOrigin="0.5,0.5" Fill="Black" Data="M725 977l-170 -450c99 -1 198 -4 297 -4c19 0 38 1 57 2c-52 152 -113 307 -184 452zM0 -128l2 79c94 29 196 9 238 117l237 616l280 724h128c4 -7 8 -14 11 -21l205 -480c75 -177 144 -356 220 -532c45 -104 80 -211 130 -313c7 -16 21 -46 35 -57 c33 -26 125 -32 172 -50c3 -19 6 -38 6 -57c0 -9 -1 -17 -1 -26c-127 0 -254 16 -381 16c-131 0 -262 -11 -393 -15c0 26 1 52 4 78l131 28c27 6 80 13 80 50c0 36 -129 333 -145 374l-450 2c-26 -58 -127 -320 -127 -358c0 -77 147 -80 204 -88c1 -19 1 -38 1 -58 c0 -9 -1 -18 -2 -27c-116 0 -233 20 -349 20c-14 0 -34 -6 -48 -8c-63 -11 -125 -14 -188 -14z">
|
||||
<Path.RenderTransform>
|
||||
<ScaleTransform ScaleY="-1"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
|
||||
</Grid>
|
||||
</controls:ColorPicker.Content>
|
||||
</controls:ColorPicker>
|
||||
<controls:ColorPicker SelectedColor="{Binding SelectedItem.ColorViewModel.FillColor.Color}">
|
||||
<controls:ColorPicker.Content>
|
||||
<Grid>
|
||||
<Rectangle VerticalAlignment="Bottom"
|
||||
Height="4"
|
||||
Width="14"
|
||||
HorizontalAlignment="Center">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding SelectedItem.ColorViewModel.FillColor.Color}" />
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Path Width="14" Height="14" Stretch="Uniform" RenderTransformOrigin="0.5,0.5" Fill="Black" Data="M853.333 362.667c-3.925-2.731-85.333-88.875-85.333-149.333 0-63.744 40.491-104.448 85.333-106.667 38.656-1.877 85.333 38.016 85.333 106.667 0 64-81.408 146.603-85.333 149.333zM409.003 106.667c16.128-16.128 37.547-25.003 60.331-25.003s44.203 8.875 60.331 25.003l298.667 298.667-456.832 456.832-60.331-60.331 97.835-97.835-238.336-238.336c-16.128-16.128-25.003-37.547-25.003-60.331s8.875-44.203 25.003-60.331l238.336-238.336zM469.333 643.669l238.336-238.336h-476.672l238.336 238.336z">
|
||||
<Path.RenderTransform>
|
||||
<ScaleTransform ScaleY="-1"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Grid>
|
||||
</controls:ColorPicker.Content>
|
||||
</controls:ColorPicker>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -583,12 +619,12 @@
|
||||
</StackPanel>
|
||||
</controls:DropDownButton.Content>
|
||||
<controls:DropDownButton.Items>
|
||||
<MenuItem Header="展开到一级节点" IsCheckable="True" Command="{Binding Expand2Level1Command}" />
|
||||
<MenuItem Header="展开到二级节点" IsCheckable="True" Command="{Binding Expand2Level2Command}" />
|
||||
<MenuItem Header="展开到三级节点" IsCheckable="True" Command="{Binding Expand2Level3Command}" />
|
||||
<MenuItem Header="展开到四级节点" IsCheckable="True" Command="{Binding Expand2Level4Command}" />
|
||||
<MenuItem Header="展开到五级节点" IsCheckable="True" Command="{Binding Expand2Level5Command}" />
|
||||
<MenuItem Header="展开到六级节点" IsCheckable="True" Command="{Binding Expand2Level6Command}" />
|
||||
<MenuItem Header="展开到一级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="1"/>
|
||||
<MenuItem Header="展开到二级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="2"/>
|
||||
<MenuItem Header="展开到三级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="3"/>
|
||||
<MenuItem Header="展开到四级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="4"/>
|
||||
<MenuItem Header="展开到五级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="5"/>
|
||||
<MenuItem Header="展开到六级节点" Command="{Binding Expand2LevelCommand}" CommandParameter="6"/>
|
||||
</controls:DropDownButton.Items>
|
||||
</controls:DropDownButton>
|
||||
<controls:DropDownButton Grid.Column="1">
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/TagControl.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/ColorCanvas.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/ColorPicker.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/OpenFileTextBox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -9,7 +9,7 @@
|
||||
<dd:IntToVisibilityConverter x:Key="IntToVisibilityConverter"/>
|
||||
<dd:DoubleToThickness x:Key="DoubleToThickness"/>
|
||||
<dd:NullableToVisibilityConverter x:Key="NullableToVisibilityConverter"/>
|
||||
|
||||
<dd:NotNullOrEmptyToBoolConverter x:Key="NotNullOrEmptyToBoolConverter"/>
|
||||
<!-- Toggle Button -->
|
||||
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
@@ -69,7 +69,10 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image x:Name="image" Source="{Binding ImageInfo.Url}" Stretch="Fill" Width="128" Height="128" Visibility="{Binding ImageInfo.Url,FallbackValue='',Converter={StaticResource NullableToVisibilityConverter}}" IsHitTestVisible="False"/>
|
||||
<Image x:Name="image" Margin="5" Stretch="Fill" Width="128" Height="128"
|
||||
Visibility="{Binding ImageInfo.Url,FallbackValue='',Converter={StaticResource NullableToVisibilityConverter}}"
|
||||
ToolTip="{Binding ImageInfo.Text}"
|
||||
IsHitTestVisible="False"/>
|
||||
<Grid Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@@ -100,6 +103,9 @@
|
||||
<ToggleButton x:Name="toggle" IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding ImageInfo.Url,Converter={StaticResource NotNullOrEmptyToBoolConverter}}" Value="true">
|
||||
<Setter TargetName="image" Property="Source" Value="{Binding ImageInfo.Url}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding ConnectorOrientation}" Value="None">
|
||||
<Setter TargetName="toggle" Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
|
||||
@@ -80,34 +80,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level1Command
|
||||
SimpleCommand Expand2LevelCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level2Command
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level3Command
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level4Command
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level5Command
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
SimpleCommand Expand2Level6Command
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,57 +273,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level1Command;
|
||||
public SimpleCommand Expand2Level1Command
|
||||
private SimpleCommand _expand2LevelCommand;
|
||||
public SimpleCommand Expand2LevelCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level1Command ?? (this._expand2Level1Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level1Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level2Command;
|
||||
public SimpleCommand Expand2Level2Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level2Command ?? (this._expand2Level2Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level2Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level3Command;
|
||||
public SimpleCommand Expand2Level3Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level3Command ?? (this._expand2Level3Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level3Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level4Command;
|
||||
public SimpleCommand Expand2Level4Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level4Command ?? (this._expand2Level4Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level4Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level5Command;
|
||||
public SimpleCommand Expand2Level5Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level5Command ?? (this._expand2Level5Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level5Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level6Command;
|
||||
public SimpleCommand Expand2Level6Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level6Command));
|
||||
return this._expand2LevelCommand ?? (this._expand2LevelCommand = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2LevelCommand));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -653,24 +608,41 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.LinkInfo != null)
|
||||
{
|
||||
p.LinkInfo.Link = null; p.LinkInfo.Text = null;
|
||||
p.LinkInfo.Link = null;
|
||||
p.LinkInfo.Text = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecuteAddImageCommand(object obj)
|
||||
{
|
||||
if (obj is object[] array && array.Length == 2)
|
||||
{
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.ImageInfo == null)
|
||||
p.ImageInfo = new ImageInfo();
|
||||
|
||||
p.ImageInfo.Url = array[0]?.ToString();
|
||||
p.ImageInfo.Text = array[1]?.ToString();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteRemoveImageCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.ImageInfo != null)
|
||||
{
|
||||
p.ImageInfo.Url = null;
|
||||
p.ImageInfo.Text = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecuteAddRemarkCommand(object obj)
|
||||
{
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = "备注");
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = obj?.ToString());
|
||||
}
|
||||
|
||||
private void ExecuteRemoveRemarkCommand(object obj)
|
||||
@@ -776,6 +748,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private MindNode FormatNode;
|
||||
private void ExecutedCopyThemeCommand(object parameter)
|
||||
{
|
||||
if (parameter is MindNode node)
|
||||
@@ -789,44 +762,68 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
if (node != null)
|
||||
{
|
||||
|
||||
FormatNode = node;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutedPasteThemeCommand(object parameter)
|
||||
{
|
||||
if (FormatNode != null)
|
||||
{
|
||||
List<MindNode> nodes = new List<MindNode>();
|
||||
if (parameter is MindNode node1)
|
||||
{
|
||||
nodes.Add(node1);
|
||||
}
|
||||
else if (parameter is IEnumerable<MindNode> para)
|
||||
{
|
||||
nodes.AddRange(para);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.AddRange(SelectedItems.OfType<MindNode>());
|
||||
}
|
||||
|
||||
if (nodes.Any())
|
||||
{
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
() => {
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
CopyHelper.CopyPropertyValue(FormatNode.ColorViewModel, node.ColorViewModel);
|
||||
CopyHelper.CopyPropertyValue(FormatNode.FontViewModel, node.FontViewModel);
|
||||
}
|
||||
RootItem.LayoutUpdated();
|
||||
},
|
||||
() => {
|
||||
//ToDo
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level1Command(object obj)
|
||||
private void ExecutedExpand2LevelCommand(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level2Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level3Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level4Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level5Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level6Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
int level = 0;
|
||||
int.TryParse(obj?.ToString(), out level);
|
||||
foreach (var item in Items.OfType<MindNode>())
|
||||
{
|
||||
if (item.NodeLevel == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.NodeLevel < level)
|
||||
{
|
||||
item.IsExpanded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsExpanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
protected override void ExecutedResetLayoutCommand(object obj)
|
||||
{
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
MoveBackCommand = (Root as IMindDiagramViewModel)?.MoveBackCommand;
|
||||
BuildMenuOptions();
|
||||
Tags = new ObservableCollection<string>();
|
||||
LinkInfo = new LinkInfo();
|
||||
ImageInfo = new ImageInfo();
|
||||
}
|
||||
|
||||
public void InitLayout(bool initAppearance)
|
||||
@@ -228,7 +230,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
#endregion
|
||||
|
||||
#region 附加信息属性
|
||||
private LinkInfo _linkInfo = new LinkInfo();
|
||||
private LinkInfo _linkInfo;
|
||||
public LinkInfo LinkInfo
|
||||
{
|
||||
get
|
||||
@@ -249,7 +251,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private ImageInfo _imageInfo = new ImageInfo();
|
||||
private ImageInfo _imageInfo;
|
||||
public ImageInfo ImageInfo
|
||||
{
|
||||
get
|
||||
@@ -539,7 +541,21 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
break;
|
||||
}
|
||||
case nameof(ImageInfo.Url):
|
||||
break;
|
||||
{
|
||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||
{
|
||||
if (string.IsNullOrEmpty(valuePropertyChangedEventArgs.OldValue?.ToString()) && !string.IsNullOrEmpty(valuePropertyChangedEventArgs.NewValue?.ToString()))
|
||||
{
|
||||
ItemWidth = Math.Max(ItemWidth, 160);
|
||||
ItemHeight += 135;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(valuePropertyChangedEventArgs.OldValue?.ToString()) && string.IsNullOrEmpty(valuePropertyChangedEventArgs.NewValue?.ToString()))
|
||||
{
|
||||
ItemHeight -= 135;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user