diff --git a/AIStudio.Wpf.DiagramDesigner/Converters/NullableToVisibilityConverter.cs b/AIStudio.Wpf.DiagramDesigner/Converters/NullableToVisibilityConverter.cs
index 94389a3..84d4356 100644
--- a/AIStudio.Wpf.DiagramDesigner/Converters/NullableToVisibilityConverter.cs
+++ b/AIStudio.Wpf.DiagramDesigner/Converters/NullableToVisibilityConverter.cs
@@ -14,7 +14,7 @@ namespace AIStudio.Wpf.DiagramDesigner
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- return value == null ? NullValue : NotNullValue;
+ return string.IsNullOrEmpty(value?.ToString()) ? NullValue : NotNullValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/AIStudio.Wpf.Mind/Controls/LinkControl.xaml b/AIStudio.Wpf.Mind/Controls/LinkControl.xaml
index 5a3eb24..1cd2d9f 100644
--- a/AIStudio.Wpf.Mind/Controls/LinkControl.xaml
+++ b/AIStudio.Wpf.Mind/Controls/LinkControl.xaml
@@ -1,12 +1,46 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/AIStudio.Wpf.Mind/Controls/LinkControl.xaml.cs b/AIStudio.Wpf.Mind/Controls/LinkControl.xaml.cs
index 631a21f..e9d89c3 100644
--- a/AIStudio.Wpf.Mind/Controls/LinkControl.xaml.cs
+++ b/AIStudio.Wpf.Mind/Controls/LinkControl.xaml.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -18,11 +20,48 @@ namespace AIStudio.Wpf.Mind.Controls
///
/// LinkControl.xaml 的交互逻辑
///
- public partial class LinkControl : UserControl
+ [TemplatePart(Name = "PART_InnerHyperlink", Type = typeof(Hyperlink))]
+ public class LinkControl : Control
{
- public LinkControl()
+ public static readonly DependencyProperty UrlProperty =
+ DependencyProperty.Register(nameof(Url), typeof(string), typeof(LinkControl));
+
+ [Category("Common Properties"), Bindable(true)]
+ public string Url
{
- InitializeComponent();
+ get
+ {
+ return GetValue(UrlProperty) as string;
+ }
+ set
+ {
+ SetValue(UrlProperty, value);
+ }
+ }
+
+ static LinkControl()
+ {
+ FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(
+ typeof(LinkControl),
+ new FrameworkPropertyMetadata(typeof(LinkControl)));
+
+ }
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+
+ Hyperlink innerHyperlink = GetTemplateChild("PART_InnerHyperlink") as Hyperlink;
+ if (innerHyperlink != null)
+ {
+ innerHyperlink.Click += new RoutedEventHandler(InnerHyperlink_Click);
+ }
+ }
+
+ void InnerHyperlink_Click(object sender, RoutedEventArgs e)
+ {
+ // 激活的是当前默认的浏览器
+ Process.Start("explorer.exe", Url);
}
}
}
diff --git a/AIStudio.Wpf.Mind/Controls/RateControl.xaml b/AIStudio.Wpf.Mind/Controls/RateControl.xaml
index 26b9ee1..cd46df3 100644
--- a/AIStudio.Wpf.Mind/Controls/RateControl.xaml
+++ b/AIStudio.Wpf.Mind/Controls/RateControl.xaml
@@ -21,47 +21,36 @@
-
-
-
-
+
-
-
-
-
-
-
-
-
diff --git a/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml b/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
index 15854a9..7cab0da 100644
--- a/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
+++ b/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml
@@ -119,8 +119,8 @@
-
-
+
+
diff --git a/AIStudio.Wpf.Mind/Themes/Generic.xaml b/AIStudio.Wpf.Mind/Themes/Generic.xaml
index fc0301c..264edb5 100644
--- a/AIStudio.Wpf.Mind/Themes/Generic.xaml
+++ b/AIStudio.Wpf.Mind/Themes/Generic.xaml
@@ -4,7 +4,7 @@
-
+
diff --git a/AIStudio.Wpf.Mind/Themes/MindNode.xaml b/AIStudio.Wpf.Mind/Themes/MindNode.xaml
index bb2fd84..14331b6 100644
--- a/AIStudio.Wpf.Mind/Themes/MindNode.xaml
+++ b/AIStudio.Wpf.Mind/Themes/MindNode.xaml
@@ -55,9 +55,9 @@
-
+
-
+
-
-
+
+
-
+
diff --git a/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs b/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs
index 0acb79c..0461451 100644
--- a/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs
+++ b/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs
@@ -625,12 +625,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
private void ExecuteAddLinkCommand(object obj)
{
-
+ SelectedItems.OfType().ToList().ForEach(p => p.LinkInfo = new LinkInfo() { Url = "https://naotu.baidu.com", Text = "https://naotu.baidu.com" });
}
private void ExecuteRemoveLinkCommand(object obj)
{
-
+ SelectedItems.OfType().ToList().ForEach(p => p.LinkInfo = null);
}
private void ExecuteAddImageCommand(object obj)
@@ -667,7 +667,14 @@ namespace AIStudio.Wpf.Mind.ViewModels
private void ExecuteAddRatioCommand(object obj)
{
-
+ if (double.TryParse(obj.ToString(), out var rate))
+ {
+ SelectedItems.OfType().ToList().ForEach(p => p.Rate = rate);
+ }
+ else
+ {
+ SelectedItems.OfType().ToList().ForEach(p => p.Rate = null);
+ }
}
private void ExecuteAddTagCommand(object obj)