mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
结构调整,便于后续扩展
This commit is contained in:
@@ -13,16 +13,6 @@
|
||||
<Page Remove="DesignItems\Custom\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Controls\AnimationHelper.cs" />
|
||||
<Compile Remove="Controls\CancelRoutedEventArgs.cs" />
|
||||
<Compile Remove="Controls\ContextMenuToggleButton.cs" />
|
||||
<Compile Remove="Controls\ScrollViewer.xaml.cs" />
|
||||
<Compile Remove="Controls\TabControl.xaml.cs" />
|
||||
<Compile Remove="Controls\TabItem.cs" />
|
||||
<Compile Remove="Controls\TabPanel.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Icons\App.ico" />
|
||||
<None Remove="Images\AlignObjectsBottom.png" />
|
||||
@@ -115,8 +105,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Remove="Controls\ScrollViewer.xaml" />
|
||||
<Page Remove="Controls\TabControl.xaml" />
|
||||
<Page Remove="Images\VectorIcons.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -128,13 +116,13 @@
|
||||
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.8.0" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.VaadinIcons" Version="4.8.0" />
|
||||
<PackageReference Include="MathParser.org-mXparser" Version="4.4.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Util.Svg2XamlTestExtension" Version="1.2.5" />
|
||||
<PackageReference Include="WpfAnimatedGif" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AIStudio.Wpf.BaseDiagram\AIStudio.Wpf.BaseDiagram.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.Logical\AIStudio.Wpf.Logical.csproj" />
|
||||
<ProjectReference Include="..\Util.DiagramDesigner\Util.DiagramDesigner.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -239,32 +227,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\PopupWindow.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Demos\Logical\ViewModels\LogicalGateItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\BarcodeDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\PersistDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\SettingsDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\OutLineTextDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\PathItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Themes\Generic.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.ADiagram;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/ViewModels/FlowNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Logical;component/ViewModels/LogicalGateItemViewModel.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class CancelRoutedEventArgs : RoutedEventArgs
|
||||
{
|
||||
public CancelRoutedEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Cancel { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 带上下文菜单的切换按钮
|
||||
/// </summary>
|
||||
public class ContextMenuToggleButton : ToggleButton
|
||||
{
|
||||
public ContextMenu Menu { get; set; }
|
||||
|
||||
protected override void OnClick()
|
||||
{
|
||||
base.OnClick();
|
||||
if (Menu != null)
|
||||
{
|
||||
if (IsChecked == true)
|
||||
{
|
||||
Menu.PlacementTarget = this;
|
||||
Menu.IsOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Menu.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/ScrollViewer.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="ScrollViewerBaseControlTemplate" TargetType="controls:ScrollViewer">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="Storyboard1">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.1" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.1" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="Storyboard2">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.RowSpan="2" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ScrollViewerBaseStyle" TargetType="controls:ScrollViewer">
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ScrollViewerBaseControlTemplate}"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,237 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class ScrollViewer : System.Windows.Controls.ScrollViewer
|
||||
{
|
||||
private double _totalVerticalOffset;
|
||||
|
||||
private double _totalHorizontalOffset;
|
||||
|
||||
private bool _isRunning;
|
||||
|
||||
/// <summary>
|
||||
/// 滚动方向
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
|
||||
"Orientation", typeof(Orientation), typeof(ScrollViewer), new PropertyMetadata(Orientation.Vertical));
|
||||
|
||||
/// <summary>
|
||||
/// 滚动方向
|
||||
/// </summary>
|
||||
public Orientation Orientation
|
||||
{
|
||||
get => (Orientation)GetValue(OrientationProperty);
|
||||
set => SetValue(OrientationProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否响应鼠标滚轮操作
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CanMouseWheelProperty = DependencyProperty.Register(
|
||||
"CanMouseWheel", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// 是否响应鼠标滚轮操作
|
||||
/// </summary>
|
||||
public bool CanMouseWheel
|
||||
{
|
||||
get => (bool)GetValue(CanMouseWheelProperty);
|
||||
set => SetValue(CanMouseWheelProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
if (!CanMouseWheel) return;
|
||||
|
||||
if (!IsInertiaEnabled)
|
||||
{
|
||||
if (Orientation == Orientation.Vertical)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
_totalHorizontalOffset = HorizontalOffset;
|
||||
CurrentHorizontalOffset = HorizontalOffset;
|
||||
_totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth);
|
||||
CurrentHorizontalOffset = _totalHorizontalOffset;
|
||||
}
|
||||
return;
|
||||
}
|
||||
e.Handled = true;
|
||||
|
||||
if (Orientation == Orientation.Vertical)
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalVerticalOffset = VerticalOffset;
|
||||
CurrentVerticalOffset = VerticalOffset;
|
||||
}
|
||||
_totalVerticalOffset = Math.Min(Math.Max(0, _totalVerticalOffset - e.Delta), ScrollableHeight);
|
||||
ScrollToVerticalOffsetInternal(_totalVerticalOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalHorizontalOffset = HorizontalOffset;
|
||||
CurrentHorizontalOffset = HorizontalOffset;
|
||||
}
|
||||
_totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth);
|
||||
ScrollToHorizontalOffsetInternal(_totalHorizontalOffset);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ScrollToTopInternal(double milliseconds = 500)
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalVerticalOffset = VerticalOffset;
|
||||
CurrentVerticalOffset = VerticalOffset;
|
||||
}
|
||||
ScrollToVerticalOffsetInternal(0, milliseconds);
|
||||
}
|
||||
|
||||
internal void ScrollToVerticalOffsetInternal(double offset, double milliseconds = 500)
|
||||
{
|
||||
var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
|
||||
animation.EasingFunction = new CubicEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
};
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s, e1) =>
|
||||
{
|
||||
CurrentVerticalOffset = offset;
|
||||
_isRunning = false;
|
||||
};
|
||||
_isRunning = true;
|
||||
|
||||
BeginAnimation(CurrentVerticalOffsetProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
internal void ScrollToHorizontalOffsetInternal(double offset, double milliseconds = 500)
|
||||
{
|
||||
var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
|
||||
animation.EasingFunction = new CubicEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
};
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s, e1) =>
|
||||
{
|
||||
CurrentHorizontalOffset = offset;
|
||||
_isRunning = false;
|
||||
};
|
||||
_isRunning = true;
|
||||
|
||||
BeginAnimation(CurrentHorizontalOffsetProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) =>
|
||||
IsPenetrating ? null : base.HitTestCore(hitTestParameters);
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsInertiaEnabledProperty = DependencyProperty.RegisterAttached(
|
||||
"IsInertiaEnabled", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(false));
|
||||
|
||||
public static void SetIsInertiaEnabled(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsInertiaEnabledProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsInertiaEnabled(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(IsInertiaEnabledProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public bool IsInertiaEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsInertiaEnabledProperty);
|
||||
set => SetValue(IsInertiaEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控件是否可以穿透点击
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsPenetratingProperty = DependencyProperty.RegisterAttached(
|
||||
"IsPenetrating", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 控件是否可以穿透点击
|
||||
/// </summary>
|
||||
public bool IsPenetrating
|
||||
{
|
||||
get => (bool)GetValue(IsPenetratingProperty);
|
||||
set => SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static void SetIsPenetrating(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsPenetrating(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(IsPenetratingProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前垂直滚动偏移
|
||||
/// </summary>
|
||||
internal static readonly DependencyProperty CurrentVerticalOffsetProperty = DependencyProperty.Register(
|
||||
"CurrentVerticalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(0d, OnCurrentVerticalOffsetChanged));
|
||||
|
||||
private static void OnCurrentVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ScrollViewer ctl && e.NewValue is double v)
|
||||
{
|
||||
ctl.ScrollToVerticalOffset(v);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前垂直滚动偏移
|
||||
/// </summary>
|
||||
internal double CurrentVerticalOffset
|
||||
{
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
get => (double)GetValue(CurrentVerticalOffsetProperty);
|
||||
set => SetValue(CurrentVerticalOffsetProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前水平滚动偏移
|
||||
/// </summary>
|
||||
internal static readonly DependencyProperty CurrentHorizontalOffsetProperty = DependencyProperty.Register(
|
||||
"CurrentHorizontalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(0d, OnCurrentHorizontalOffsetChanged));
|
||||
|
||||
private static void OnCurrentHorizontalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ScrollViewer ctl && e.NewValue is double v)
|
||||
{
|
||||
ctl.ScrollToHorizontalOffset(v);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前水平滚动偏移
|
||||
/// </summary>
|
||||
internal double CurrentHorizontalOffset
|
||||
{
|
||||
get => (double)GetValue(CurrentHorizontalOffsetProperty);
|
||||
set => SetValue(CurrentHorizontalOffsetProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:interactivity="clr-namespace:Util.Controls.Handy.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Basic/Paths.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Basic/Converters.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/Button.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/RepeatButton.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/ToggleButton.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ContextMenu x:Key="TabItemMenu" x:Shared="False">
|
||||
<MenuItem Command="interactivity:ControlCommands.Close" Header="Close"/>
|
||||
<MenuItem Command="interactivity:ControlCommands.CloseAll" Header="CloseAll"/>
|
||||
<MenuItem Command="interactivity:ControlCommands.CloseOther" Header="CloseOther"/>
|
||||
</ContextMenu>
|
||||
|
||||
<Style TargetType="controls:TabItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}"/>
|
||||
<Setter Property="BorderThickness" Value="1,0,1,1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="10,0,0,0"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Menu" Value="{StaticResource TabItemMenu}"/>
|
||||
<Setter Property="controls:IconElement.Width" Value="16"/>
|
||||
<Setter Property="controls:IconElement.Height" Value="16"/>
|
||||
<Setter Property="HeaderTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Background="Transparent" Text="{Binding Header,RelativeSource={RelativeSource AncestorType=controls:TabItem}}"/>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:TabItem">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true" ContextMenu="{TemplateBinding Menu}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.ColumnSpan="3" BorderThickness="{TemplateBinding BorderThickness}" x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Margin="0">
|
||||
<Border Margin="0,0,0,-1" x:Name="innerBorder" Background="{DynamicResource MahApps.Brushes.Gray8}" Visibility="Collapsed"/>
|
||||
</Border>
|
||||
<Path x:Name="PathMain" Margin="10,0,0,0" Grid.Column="0" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
|
||||
<ContentPresenter Grid.Column="1" x:Name="contentPresenter" ContentSource="Header" Focusable="False" HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
<Border Name="BorderMask" Grid.Column="1" HorizontalAlignment="Right" Width="20" Background="{TemplateBinding Background}">
|
||||
<Border.OpacityMask>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.OpacityMask>
|
||||
</Border>
|
||||
<Button Grid.Column="2" Focusable="False" Command="interactivity:ControlCommands.Close" Visibility="{TemplateBinding ShowCloseButton,Converter={StaticResource Boolean2VisibilityConverter}}" Background="Transparent" Style="{StaticResource ButtonCustom}" Width="28">
|
||||
<Path Fill="{DynamicResource MahApps.Brushes.Text}" Width="8" Height="8" Style="{StaticResource ClosePathStyle}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Panel.ZIndex" Value="1"/>
|
||||
<Setter Property="Visibility" TargetName="innerBorder" Value="Visible"/>
|
||||
<Setter Property="Background" TargetName="BorderMask" Value="{DynamicResource MahApps.Brushes.Gray8}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:IconElement.Geometry" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="TabControlPlusTemplate" TargetType="controls:TabControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}">
|
||||
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||
<interactivity:FluidMoveBehavior.EaseX>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</interactivity:FluidMoveBehavior.EaseX>
|
||||
</interactivity:FluidMoveBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</controls:TabPanel>
|
||||
</Border>
|
||||
<Border x:Name="contentPanel" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Right">
|
||||
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="TabControlPlusScrollableTemplate" TargetType="controls:TabControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="0,0,1,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Left" Panel.ZIndex="2">
|
||||
<Border.CacheMode>
|
||||
<BitmapCache SnapsToDevicePixels="True"/>
|
||||
</Border.CacheMode>
|
||||
<RepeatButton Focusable="False" Style="{StaticResource RepeatButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource MahApps.Brushes.Text}" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" x:Name="PART_ScrollButtonLeft"/>
|
||||
</Border>
|
||||
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsInertiaEnabled="True" Grid.Row="0" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
|
||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Name="PART_HeaderBorder">
|
||||
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||
<interactivity:FluidMoveBehavior.EaseX>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</interactivity:FluidMoveBehavior.EaseX>
|
||||
</interactivity:FluidMoveBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</controls:TabPanel>
|
||||
</Border>
|
||||
</controls:ScrollViewer>
|
||||
<Border Margin="0,-1,0,0" Grid.Row="0" Grid.Column="2" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Right">
|
||||
<Border.CacheMode>
|
||||
<BitmapCache SnapsToDevicePixels="True"/>
|
||||
</Border.CacheMode>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RepeatButton Focusable="False" Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource RepeatButtonIcon}" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Padding="8" controls:IconElement.Geometry="{StaticResource RightGeometry}" Foreground="{DynamicResource MahApps.Brushes.Text}" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" x:Name="PART_ScrollButtonRight"/>
|
||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Width="1" Background="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border x:Name="contentPanel" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style TargetType="controls:TabControl">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray8}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Template" Value="{StaticResource TabControlPlusTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsScrollable" Value="True"/>
|
||||
<Condition Property="IsTabFillEnabled" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Template" Value="{StaticResource TabControlPlusScrollableTemplate}"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,443 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
|
||||
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
|
||||
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
||||
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = ScrollButtonRight, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = HeaderBorder, Type = typeof(System.Windows.Controls.Border))]
|
||||
public class TabControl : System.Windows.Controls.TabControl
|
||||
{
|
||||
private const string OverflowButtonKey = "PART_OverflowButton";
|
||||
|
||||
private const string HeaderPanelKey = "PART_HeaderPanel";
|
||||
|
||||
private const string OverflowScrollviewer = "PART_OverflowScrollviewer";
|
||||
|
||||
private const string ScrollButtonLeft = "PART_ScrollButtonLeft";
|
||||
|
||||
private const string ScrollButtonRight = "PART_ScrollButtonRight";
|
||||
|
||||
private const string HeaderBorder = "PART_HeaderBorder";
|
||||
|
||||
private ContextMenuToggleButton _buttonOverflow;
|
||||
|
||||
internal TabPanel HeaderPanel { get; private set; }
|
||||
|
||||
private ScrollViewer _scrollViewerOverflow;
|
||||
|
||||
private ButtonBase _buttonScrollLeft;
|
||||
|
||||
private ButtonBase _buttonScrollRight;
|
||||
|
||||
private System.Windows.Controls.Border _headerBorder;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为内部操作
|
||||
/// </summary>
|
||||
internal bool IsInternalAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用动画
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsAnimationEnabledProperty = DependencyProperty.Register(
|
||||
"IsAnimationEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用动画
|
||||
/// </summary>
|
||||
public bool IsAnimationEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsAnimationEnabledProperty);
|
||||
set => SetValue(IsAnimationEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以拖动
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsDraggableProperty = DependencyProperty.Register(
|
||||
"IsDraggable", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以拖动
|
||||
/// </summary>
|
||||
public bool IsDraggable
|
||||
{
|
||||
get => (bool)GetValue(IsDraggableProperty);
|
||||
set => SetValue(IsDraggableProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowCloseButton", typeof(bool), typeof(TabControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, value);
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => (bool)GetValue(ShowCloseButtonProperty);
|
||||
set => SetValue(ShowCloseButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowContextMenuProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowContextMenu", typeof(bool), typeof(TabControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetShowContextMenu(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowContextMenuProperty, value);
|
||||
|
||||
public static bool GetShowContextMenu(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowContextMenuProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public bool ShowContextMenu
|
||||
{
|
||||
get => (bool)GetValue(ShowContextMenuProperty);
|
||||
set => SetValue(ShowContextMenuProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
|
||||
"IsTabFillEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public bool IsTabFillEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsTabFillEnabledProperty);
|
||||
set => SetValue(IsTabFillEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
|
||||
"TabItemWidth", typeof(double), typeof(TabControl), new PropertyMetadata(200.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public double TabItemWidth
|
||||
{
|
||||
get => (double)GetValue(TabItemWidthProperty);
|
||||
set => SetValue(TabItemWidthProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
|
||||
"TabItemHeight", typeof(double), typeof(TabControl), new PropertyMetadata(30.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public double TabItemHeight
|
||||
{
|
||||
get => (double)GetValue(TabItemHeightProperty);
|
||||
set => SetValue(TabItemHeightProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以滚动
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsScrollableProperty = DependencyProperty.Register(
|
||||
"IsScrollable", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以滚动
|
||||
/// </summary>
|
||||
public bool IsScrollable
|
||||
{
|
||||
get => (bool) GetValue(IsScrollableProperty);
|
||||
set => SetValue(IsScrollableProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示溢出按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowOverflowButtonProperty = DependencyProperty.Register(
|
||||
"ShowOverflowButton", typeof(bool), typeof(TabControl), new PropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示溢出按钮
|
||||
/// </summary>
|
||||
public bool ShowOverflowButton
|
||||
{
|
||||
get => (bool) GetValue(ShowOverflowButtonProperty);
|
||||
set => SetValue(ShowOverflowButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示滚动按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowScrollButtonProperty = DependencyProperty.Register(
|
||||
"ShowScrollButton", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示滚动按钮
|
||||
/// </summary>
|
||||
public bool ShowScrollButton
|
||||
{
|
||||
get => (bool) GetValue(ShowScrollButtonProperty);
|
||||
set => SetValue(ShowScrollButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 可见的标签数量
|
||||
/// </summary>
|
||||
private int _itemShowCount;
|
||||
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
base.OnItemsChanged(e);
|
||||
|
||||
if (HeaderPanel == null)
|
||||
{
|
||||
IsInternalAction = false;
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateOverflowButton();
|
||||
|
||||
if (IsInternalAction)
|
||||
{
|
||||
IsInternalAction = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsAnimationEnabled)
|
||||
{
|
||||
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
}
|
||||
else
|
||||
{
|
||||
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
}
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) return;
|
||||
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
item.TabPanel = HeaderPanel;
|
||||
}
|
||||
}
|
||||
|
||||
_headerBorder?.InvalidateMeasure();
|
||||
|
||||
IsInternalAction = false;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
if (_buttonOverflow.Menu != null)
|
||||
{
|
||||
_buttonOverflow.Menu.Closed -= Menu_Closed;
|
||||
_buttonOverflow.Menu = null;
|
||||
}
|
||||
|
||||
_buttonOverflow.Click -= ButtonOverflow_Click;
|
||||
}
|
||||
|
||||
if (_buttonScrollLeft != null) _buttonScrollLeft.Click -= ButtonScrollLeft_Click;
|
||||
if (_buttonScrollRight != null) _buttonScrollRight.Click -= ButtonScrollRight_Click;
|
||||
|
||||
base.OnApplyTemplate();
|
||||
HeaderPanel = GetTemplateChild(HeaderPanelKey) as TabPanel;
|
||||
|
||||
if (IsTabFillEnabled) return;
|
||||
|
||||
_buttonOverflow = GetTemplateChild(OverflowButtonKey) as ContextMenuToggleButton;
|
||||
_scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer;
|
||||
_buttonScrollLeft = GetTemplateChild(ScrollButtonLeft) as ButtonBase;
|
||||
_buttonScrollRight = GetTemplateChild(ScrollButtonRight) as ButtonBase;
|
||||
_headerBorder = GetTemplateChild(HeaderBorder) as System.Windows.Controls.Border;
|
||||
|
||||
if (_buttonScrollLeft != null) _buttonScrollLeft.Click += ButtonScrollLeft_Click;
|
||||
if (_buttonScrollRight != null) _buttonScrollRight.Click += ButtonScrollRight_Click;
|
||||
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
var menu = new System.Windows.Controls.ContextMenu
|
||||
{
|
||||
Placement = PlacementMode.Bottom,
|
||||
PlacementTarget = _buttonOverflow
|
||||
};
|
||||
menu.Closed += Menu_Closed;
|
||||
_buttonOverflow.Menu = menu;
|
||||
_buttonOverflow.Click += ButtonOverflow_Click;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
UpdateOverflowButton();
|
||||
}
|
||||
|
||||
private void UpdateOverflowButton()
|
||||
{
|
||||
if (!IsTabFillEnabled)
|
||||
{
|
||||
_itemShowCount = (int)(ActualWidth / TabItemWidth);
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
_buttonOverflow.Visibility = (ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount) ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Closed(object sender, RoutedEventArgs e) => _buttonOverflow.IsChecked = false;
|
||||
|
||||
private void ButtonScrollRight_Click(object sender, RoutedEventArgs e) =>
|
||||
_scrollViewerOverflow.ScrollToHorizontalOffsetInternal(Math.Min(
|
||||
_scrollViewerOverflow.CurrentHorizontalOffset + TabItemWidth, _scrollViewerOverflow.ScrollableWidth));
|
||||
|
||||
private void ButtonScrollLeft_Click(object sender, RoutedEventArgs e) =>
|
||||
_scrollViewerOverflow.ScrollToHorizontalOffsetInternal(Math.Max(
|
||||
_scrollViewerOverflow.CurrentHorizontalOffset - TabItemWidth, 0));
|
||||
|
||||
private void ButtonOverflow_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_buttonOverflow.IsChecked == true)
|
||||
{
|
||||
_buttonOverflow.Menu.Items.Clear();
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if(!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) continue;
|
||||
|
||||
var menuItem = new System.Windows.Controls.MenuItem
|
||||
{
|
||||
HeaderStringFormat = ItemStringFormat,
|
||||
HeaderTemplate = ItemTemplate,
|
||||
HeaderTemplateSelector = ItemTemplateSelector,
|
||||
Header = item.Header,
|
||||
Width = TabItemWidth,
|
||||
IsChecked = item.IsSelected,
|
||||
IsCheckable = true
|
||||
};
|
||||
|
||||
menuItem.Click += delegate
|
||||
{
|
||||
_buttonOverflow.IsChecked = false;
|
||||
|
||||
var list = GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
var actualItem = ItemContainerGenerator.ItemFromContainer(item);
|
||||
if (actualItem == null) return;
|
||||
|
||||
var index = list.IndexOf(actualItem);
|
||||
if (index >= _itemShowCount)
|
||||
{
|
||||
list.Remove(actualItem);
|
||||
list.Insert(0, actualItem);
|
||||
if (IsAnimationEnabled)
|
||||
{
|
||||
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
}
|
||||
else
|
||||
{
|
||||
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
}
|
||||
HeaderPanel.ForceUpdate = true;
|
||||
HeaderPanel.Measure(new Size(HeaderPanel.DesiredSize.Width, ActualHeight));
|
||||
HeaderPanel.ForceUpdate = false;
|
||||
SetCurrentValue(SelectedIndexProperty, 0);
|
||||
}
|
||||
|
||||
item.IsSelected = true;
|
||||
};
|
||||
_buttonOverflow.Menu.Items.Add(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal double GetHorizontalOffset() => _scrollViewerOverflow?.CurrentHorizontalOffset ?? 0;
|
||||
|
||||
internal void UpdateScroll() => _scrollViewerOverflow?.RaiseEvent(new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, 0)
|
||||
{
|
||||
RoutedEvent = MouseWheelEvent
|
||||
});
|
||||
|
||||
internal void CloseAllItems() => CloseOtherItems(null);
|
||||
|
||||
internal void CloseOtherItems(TabItem currentItem)
|
||||
{
|
||||
var actualItem = currentItem != null ? ItemContainerGenerator.ItemFromContainer(currentItem) : null;
|
||||
|
||||
var list = GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
IsInternalAction = true;
|
||||
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
if (!Equals(item, actualItem) && item != null)
|
||||
{
|
||||
var argsClosing = new CancelRoutedEventArgs(TabItem.ClosingEvent, item);
|
||||
|
||||
if (!(ItemContainerGenerator.ContainerFromItem(item) is TabItem tabItem)) continue;
|
||||
|
||||
tabItem.RaiseEvent(argsClosing);
|
||||
if (argsClosing.Cancel) return;
|
||||
|
||||
tabItem.RaiseEvent(new RoutedEventArgs(TabItem.ClosedEvent, item));
|
||||
list.Remove(item);
|
||||
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
SetCurrentValue(SelectedIndexProperty, Items.Count == 0 ? -1 : 0);
|
||||
}
|
||||
|
||||
internal IList GetActualList()
|
||||
{
|
||||
IList list;
|
||||
if (ItemsSource != null)
|
||||
{
|
||||
list = ItemsSource as IList;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Items;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is TabItem;
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new TabItem();
|
||||
}
|
||||
}
|
||||
@@ -1,467 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class TabItem : System.Windows.Controls.TabItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 动画速度
|
||||
/// </summary>
|
||||
private const int AnimationSpeed = 150;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否处于拖动状态
|
||||
/// </summary>
|
||||
private static bool ItemIsDragging;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否等待被拖动
|
||||
/// </summary>
|
||||
private bool _isWaiting;
|
||||
|
||||
/// <summary>
|
||||
/// 拖动中的选项卡坐标
|
||||
/// </summary>
|
||||
private Point _dragPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时选项卡位置
|
||||
/// </summary>
|
||||
private int _mouseDownIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时选项卡横向偏移
|
||||
/// </summary>
|
||||
private double _mouseDownOffsetX;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时的坐标
|
||||
/// </summary>
|
||||
private Point _mouseDownPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 右侧可移动的最大值
|
||||
/// </summary>
|
||||
private double _maxMoveRight;
|
||||
|
||||
/// <summary>
|
||||
/// 左侧可移动的最大值
|
||||
/// </summary>
|
||||
private double _maxMoveLeft;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡宽度
|
||||
/// </summary>
|
||||
public double ItemWidth { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡拖动等待距离(在鼠标移动了超过20个像素无关单位后,选项卡才开始被拖动)
|
||||
/// </summary>
|
||||
private const double WaitLength = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否处于拖动状态
|
||||
/// </summary>
|
||||
private bool _isDragging;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否已经被拖动
|
||||
/// </summary>
|
||||
private bool _isDragged;
|
||||
|
||||
/// <summary>
|
||||
/// 目标横向位移
|
||||
/// </summary>
|
||||
internal double TargetOffsetX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前编号
|
||||
/// </summary>
|
||||
private int _currentIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 标签容器横向滚动距离
|
||||
/// </summary>
|
||||
private double _scrollHorizontalOffset;
|
||||
|
||||
private TabPanel _tabPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 标签容器
|
||||
/// </summary>
|
||||
internal TabPanel TabPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tabPanel == null && TabControlParent != null)
|
||||
{
|
||||
_tabPanel = TabControlParent.HeaderPanel;
|
||||
}
|
||||
|
||||
return _tabPanel;
|
||||
}
|
||||
set => _tabPanel = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前编号
|
||||
/// </summary>
|
||||
internal int CurrentIndex
|
||||
{
|
||||
get => _currentIndex;
|
||||
set
|
||||
{
|
||||
if (_currentIndex == value || value < 0) return;
|
||||
var oldIndex = _currentIndex;
|
||||
_currentIndex = value;
|
||||
UpdateItemOffsetX(oldIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty =
|
||||
TabControl.ShowCloseButtonProperty.AddOwner(typeof(TabItem));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => (bool)GetValue(ShowCloseButtonProperty);
|
||||
set => SetValue(ShowCloseButtonProperty, value);
|
||||
}
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, value);
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowContextMenuProperty =
|
||||
TabControl.ShowContextMenuProperty.AddOwner(typeof(TabItem), new FrameworkPropertyMetadata(OnShowContextMenuChanged));
|
||||
|
||||
private static void OnShowContextMenuChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (TabItem) d;
|
||||
if (ctl.Menu != null)
|
||||
{
|
||||
var show = (bool)e.NewValue;
|
||||
ctl.Menu.IsEnabled = show;
|
||||
ctl.Menu.Show(show);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public bool ShowContextMenu
|
||||
{
|
||||
get => (bool) GetValue(ShowContextMenuProperty);
|
||||
set => SetValue(ShowContextMenuProperty, value);
|
||||
}
|
||||
|
||||
public static void SetShowContextMenu(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowContextMenuProperty, value);
|
||||
|
||||
public static bool GetShowContextMenu(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowContextMenuProperty);
|
||||
|
||||
public static readonly DependencyProperty MenuProperty = DependencyProperty.Register(
|
||||
"Menu", typeof(System.Windows.Controls.ContextMenu), typeof(TabItem), new PropertyMetadata(default(System.Windows.Controls.ContextMenu), OnMenuChanged));
|
||||
|
||||
private static void OnMenuChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (TabItem) d;
|
||||
ctl.OnMenuChanged(e.NewValue as System.Windows.Controls.ContextMenu);
|
||||
}
|
||||
|
||||
private void OnMenuChanged(System.Windows.Controls.ContextMenu menu)
|
||||
{
|
||||
if (IsLoaded && menu != null)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
|
||||
menu.DataContext = item;
|
||||
menu.SetBinding(IsEnabledProperty, new Binding(ShowContextMenuProperty.Name)
|
||||
{
|
||||
Source = this
|
||||
});
|
||||
menu.SetBinding(VisibilityProperty, new Binding(ShowContextMenuProperty.Name)
|
||||
{
|
||||
Source = this,
|
||||
Converter = ResourceHelper.GetResource<IValueConverter>("Boolean2VisibilityConverter")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public System.Windows.Controls.ContextMenu Menu
|
||||
{
|
||||
get => (System.Windows.Controls.ContextMenu) GetValue(MenuProperty);
|
||||
set => SetValue(MenuProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新选项卡横向偏移
|
||||
/// </summary>
|
||||
/// <param name="oldIndex"></param>
|
||||
private void UpdateItemOffsetX(int oldIndex)
|
||||
{
|
||||
if (!_isDragging) return;
|
||||
var moveItem = TabPanel.ItemDic[CurrentIndex];
|
||||
moveItem.CurrentIndex -= CurrentIndex - oldIndex;
|
||||
var offsetX = moveItem.TargetOffsetX;
|
||||
var resultX = offsetX + (oldIndex - CurrentIndex) * ItemWidth;
|
||||
TabPanel.ItemDic[CurrentIndex] = this;
|
||||
TabPanel.ItemDic[moveItem.CurrentIndex] = moveItem;
|
||||
moveItem.CreateAnimation(offsetX, resultX);
|
||||
}
|
||||
|
||||
public TabItem()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Close, (s, e) => Close()));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.CloseAll,
|
||||
(s, e) => { TabControlParent.CloseAllItems(); }));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.CloseOther,
|
||||
(s, e) => { TabControlParent.CloseOtherItems(this); }));
|
||||
|
||||
Loaded += (s, e) => OnMenuChanged(Menu);
|
||||
}
|
||||
|
||||
private Util.Controls.Handy.TabControls.TabControl TabControlParent => System.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(this) as TabControl;
|
||||
|
||||
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseRightButtonDown(e);
|
||||
IsSelected = true;
|
||||
Focus();
|
||||
}
|
||||
|
||||
protected override void OnHeaderChanged(object oldHeader, object newHeader)
|
||||
{
|
||||
base.OnHeaderChanged(oldHeader, newHeader);
|
||||
|
||||
if (TabPanel != null)
|
||||
{
|
||||
TabPanel.ForceUpdate = true;
|
||||
InvalidateMeasure();
|
||||
TabPanel.ForceUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Close()
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
|
||||
var argsClosing = new CancelRoutedEventArgs(ClosingEvent, item);
|
||||
RaiseEvent(argsClosing);
|
||||
if (argsClosing.Cancel) return;
|
||||
|
||||
TabPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, parent.IsAnimationEnabled
|
||||
? new Duration(TimeSpan.FromMilliseconds(200))
|
||||
: new Duration(TimeSpan.FromMilliseconds(1)));
|
||||
|
||||
parent.IsInternalAction = true;
|
||||
RaiseEvent(new RoutedEventArgs(ClosedEvent, item));
|
||||
|
||||
var list = parent.GetActualList();
|
||||
list?.Remove(item);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.IsDraggable && !ItemIsDragging && !_isDragging)
|
||||
{
|
||||
parent.UpdateScroll();
|
||||
TabPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
_mouseDownOffsetX = RenderTransform.Value.OffsetX;
|
||||
_scrollHorizontalOffset = parent.GetHorizontalOffset();
|
||||
var mx = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
_mouseDownIndex = CalLocationIndex(mx);
|
||||
var subIndex = _mouseDownIndex - CalLocationIndex(_scrollHorizontalOffset);
|
||||
_maxMoveLeft = -subIndex * ItemWidth;
|
||||
_maxMoveRight = parent.ActualWidth - ActualWidth + _maxMoveLeft;
|
||||
|
||||
_isDragging = true;
|
||||
ItemIsDragging = true;
|
||||
_isWaiting = true;
|
||||
_dragPoint = e.GetPosition(parent);
|
||||
_dragPoint = new Point(_dragPoint.X + _scrollHorizontalOffset, _dragPoint.Y);
|
||||
_mouseDownPoint = _dragPoint;
|
||||
CaptureMouse();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
if (ItemIsDragging && _isDragging)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var subX = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
CurrentIndex = CalLocationIndex(subX);
|
||||
|
||||
var p = e.GetPosition(parent);
|
||||
p = new Point(p.X + _scrollHorizontalOffset, p.Y);
|
||||
|
||||
var subLeft = p.X - _dragPoint.X;
|
||||
var totalLeft = p.X - _mouseDownPoint.X;
|
||||
|
||||
if (Math.Abs(subLeft) <= WaitLength && _isWaiting) return;
|
||||
|
||||
_isWaiting = false;
|
||||
_isDragged = true;
|
||||
|
||||
var left = subLeft + RenderTransform.Value.OffsetX;
|
||||
if (totalLeft < _maxMoveLeft)
|
||||
{
|
||||
left = _maxMoveLeft + _mouseDownOffsetX;
|
||||
}
|
||||
else if (totalLeft > _maxMoveRight)
|
||||
{
|
||||
left = _maxMoveRight + _mouseDownOffsetX;
|
||||
}
|
||||
|
||||
var t = new TranslateTransform(left, 0);
|
||||
RenderTransform = t;
|
||||
_dragPoint = p;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseLeftButtonUp(e);
|
||||
|
||||
ReleaseMouseCapture();
|
||||
|
||||
if (_isDragged)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var subX = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
var index = CalLocationIndex(subX);
|
||||
var left = index * ItemWidth;
|
||||
var offsetX = RenderTransform.Value.OffsetX;
|
||||
CreateAnimation(offsetX, offsetX - subX + left, index);
|
||||
}
|
||||
|
||||
_isDragging = false;
|
||||
ItemIsDragging = false;
|
||||
_isDragged = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建动画
|
||||
/// </summary>
|
||||
internal void CreateAnimation(double offsetX, double resultX, int index = -1)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
|
||||
void AnimationCompleted()
|
||||
{
|
||||
RenderTransform = new TranslateTransform(resultX, 0);
|
||||
if (index == -1) return;
|
||||
|
||||
var list = parent.GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
if (item == null) return;
|
||||
|
||||
TabPanel.CanUpdate = false;
|
||||
parent.IsInternalAction = true;
|
||||
|
||||
list.Remove(item);
|
||||
parent.IsInternalAction = true;
|
||||
list.Insert(index, item);
|
||||
TabPanel.CanUpdate = true;
|
||||
TabPanel.ForceUpdate = true;
|
||||
TabPanel.Measure(new Size(TabPanel.DesiredSize.Width, ActualHeight));
|
||||
TabPanel.ForceUpdate = false;
|
||||
|
||||
Focus();
|
||||
IsSelected = true;
|
||||
|
||||
if (!IsMouseCaptured)
|
||||
{
|
||||
parent.SetCurrentValue(Selector.SelectedIndexProperty, _currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
TargetOffsetX = resultX;
|
||||
if (!parent.IsAnimationEnabled)
|
||||
{
|
||||
AnimationCompleted();
|
||||
return;
|
||||
}
|
||||
|
||||
var animation = AnimationHelper.CreateAnimation(resultX, AnimationSpeed);
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s1, e1) => AnimationCompleted();
|
||||
var f = new TranslateTransform(offsetX, 0);
|
||||
RenderTransform = f;
|
||||
f.BeginAnimation(TranslateTransform.XProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算选项卡当前合适的位置编号
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <returns></returns>
|
||||
private int CalLocationIndex(double left)
|
||||
{
|
||||
if (_isWaiting)
|
||||
{
|
||||
return CurrentIndex;
|
||||
}
|
||||
|
||||
var maxIndex = TabControlParent.Items.Count - 1;
|
||||
var div = (int)(left / ItemWidth);
|
||||
var rest = left % ItemWidth;
|
||||
var result = rest / ItemWidth > .5 ? div + 1 : div;
|
||||
|
||||
return result > maxIndex ? maxIndex : result;
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent ClosingEvent = EventManager.RegisterRoutedEvent("Closing", RoutingStrategy.Bubble, typeof(EventHandler), typeof(TabItem));
|
||||
|
||||
public event EventHandler Closing
|
||||
{
|
||||
add => AddHandler(ClosingEvent, value);
|
||||
remove => RemoveHandler(ClosingEvent, value);
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent ClosedEvent = EventManager.RegisterRoutedEvent("Closed", RoutingStrategy.Bubble, typeof(EventHandler), typeof(TabItem));
|
||||
|
||||
public event EventHandler Closed
|
||||
{
|
||||
add => AddHandler(ClosedEvent, value);
|
||||
remove => RemoveHandler(ClosedEvent, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class TabPanel : System.Windows.Controls.Panel
|
||||
{
|
||||
private int _itemCount;
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以更新
|
||||
/// </summary>
|
||||
internal bool CanUpdate = true;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡字典
|
||||
/// </summary>
|
||||
internal Dictionary<int, TabItem> ItemDic = new Dictionary<int, TabItem>();
|
||||
|
||||
/// <summary>
|
||||
/// 流式行为持续时间
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty FluidMoveDurationProperty = DependencyProperty.Register(
|
||||
"FluidMoveDuration", typeof(Duration), typeof(TabPanel), new PropertyMetadata(new Duration(TimeSpan.FromMilliseconds(200))));
|
||||
|
||||
/// <summary>
|
||||
/// 流式行为持续时间
|
||||
/// </summary>
|
||||
public Duration FluidMoveDuration
|
||||
{
|
||||
get => (Duration)GetValue(FluidMoveDurationProperty);
|
||||
set => SetValue(FluidMoveDurationProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
|
||||
"IsTabFillEnabled", typeof(bool), typeof(TabPanel), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public bool IsTabFillEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsTabFillEnabledProperty);
|
||||
set => SetValue(IsTabFillEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
|
||||
"TabItemWidth", typeof(double), typeof(TabPanel), new PropertyMetadata(200.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public double TabItemWidth
|
||||
{
|
||||
get => (double)GetValue(TabItemWidthProperty);
|
||||
set => SetValue(TabItemWidthProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
|
||||
"TabItemHeight", typeof(double), typeof(TabPanel), new PropertyMetadata(30.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public double TabItemHeight
|
||||
{
|
||||
get => (double)GetValue(TabItemHeightProperty);
|
||||
set => SetValue(TabItemHeightProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以强制更新
|
||||
/// </summary>
|
||||
internal bool ForceUpdate;
|
||||
|
||||
private Size _oldSize;
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经加载
|
||||
/// </summary>
|
||||
private bool _isLoaded;
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
if ((_itemCount == InternalChildren.Count || !CanUpdate) && !ForceUpdate) return _oldSize;
|
||||
constraint.Height = TabItemHeight;
|
||||
_itemCount = InternalChildren.Count;
|
||||
|
||||
var size = new Size();
|
||||
|
||||
ItemDic.Clear();
|
||||
|
||||
var count = InternalChildren.Count;
|
||||
if (count == 0)
|
||||
{
|
||||
_oldSize = new Size();
|
||||
return _oldSize;
|
||||
}
|
||||
constraint.Width += InternalChildren.Count;
|
||||
|
||||
var itemWidth = .0;
|
||||
var arr = new int[count];
|
||||
|
||||
if (!IsTabFillEnabled)
|
||||
{
|
||||
itemWidth = TabItemWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TemplatedParent is TabControl tabControl)
|
||||
{
|
||||
arr = ArithmeticHelper.DivideInt2Arr((int)tabControl.ActualWidth + InternalChildren.Count, count);
|
||||
}
|
||||
}
|
||||
|
||||
for (var index = 0; index < count; index++)
|
||||
{
|
||||
if (IsTabFillEnabled)
|
||||
{
|
||||
itemWidth = arr[index];
|
||||
}
|
||||
if (InternalChildren[index] is TabItem tabItem)
|
||||
{
|
||||
tabItem.RenderTransform = new TranslateTransform();
|
||||
tabItem.MaxWidth = itemWidth;
|
||||
var rect = new Rect
|
||||
{
|
||||
X = size.Width - tabItem.BorderThickness.Left,
|
||||
Width = itemWidth,
|
||||
Height = TabItemHeight
|
||||
};
|
||||
tabItem.Arrange(rect);
|
||||
tabItem.ItemWidth = itemWidth - tabItem.BorderThickness.Left;
|
||||
tabItem.CurrentIndex = index;
|
||||
tabItem.TargetOffsetX = 0;
|
||||
ItemDic[index] = tabItem;
|
||||
size.Width += tabItem.ItemWidth;
|
||||
}
|
||||
}
|
||||
size.Height = constraint.Height;
|
||||
_oldSize = size;
|
||||
return _oldSize;
|
||||
}
|
||||
|
||||
public TabPanel()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
if (_isLoaded) return;
|
||||
ForceUpdate = true;
|
||||
Measure(new Size(DesiredSize.Width, ActualHeight));
|
||||
ForceUpdate = false;
|
||||
foreach (var item in ItemDic.Values)
|
||||
{
|
||||
item.TabPanel = this;
|
||||
}
|
||||
_isLoaded = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
"ItemWidth": 65.0,
|
||||
"ItemHeight": 65.0,
|
||||
"Icon": "M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z",
|
||||
"ItemTypeName": "AIStudio.Wpf.ADiagram.Demos.Others.PathItemViewModel",
|
||||
"ItemTypeName": "AIStudio.Wpf.BaseDiagram.Extensions.ViewModels.PathItemViewModel",
|
||||
"Id": "da395032-ad9e-4dab-a035-f59bed5cb4c4",
|
||||
"ZIndex": 0,
|
||||
"IsGroup": false,
|
||||
@@ -93,76 +93,6 @@
|
||||
],
|
||||
"FlowNodeDesignerItems": [
|
||||
],
|
||||
"AllDesignerItems": [
|
||||
{
|
||||
"Left": 132.80000000000007,
|
||||
"Top": 101.26000022888184,
|
||||
"Margin": 0.0,
|
||||
"ItemWidth": 65.0,
|
||||
"ItemHeight": 65.0,
|
||||
"Icon": "M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z",
|
||||
"ItemTypeName": "AIStudio.Wpf.ADiagram.Demos.Others.PathItemViewModel",
|
||||
"Id": "da395032-ad9e-4dab-a035-f59bed5cb4c4",
|
||||
"ZIndex": 0,
|
||||
"IsGroup": false,
|
||||
"ParentId": "00000000-0000-0000-0000-000000000000",
|
||||
"Text": "欢迎来到AIStudio画板",
|
||||
"ColorItem": {
|
||||
"LineColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FF808080",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"FillColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FFFFA500",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"ShadowColor": "#00FFFFFF",
|
||||
"LineWidth": 1.0,
|
||||
"LeftArrowPathStyle": 0,
|
||||
"RightArrowPathStyle": 1,
|
||||
"LeftArrowSizeStyle": 10,
|
||||
"RightArrowSizeStyle": 10
|
||||
},
|
||||
"FontItem": {
|
||||
"FontWeight": "Normal",
|
||||
"FontStyle": "Normal",
|
||||
"FontStretch": "Normal",
|
||||
"Underline": false,
|
||||
"Strikethrough": false,
|
||||
"OverLine": false,
|
||||
"FontColor": "#FF000000",
|
||||
"FontFamily": "Arial",
|
||||
"FontSize": 11.0,
|
||||
"FontObject": "Arial, 11pt",
|
||||
"TextEffectColor": "#00FFFFFF",
|
||||
"HighlightColor": "#00FFFFFF",
|
||||
"FontCase": 0,
|
||||
"HorizontalAlignment": 1,
|
||||
"VerticalAlignment": 1,
|
||||
"LineHeight": 0.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"ConnectionIds": [
|
||||
],
|
||||
"Connections": [
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Enums
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
{
|
||||
public enum ColorType
|
||||
{
|
||||
@@ -7,9 +7,12 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Others;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.ViewModels;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.Models;
|
||||
using Newtonsoft.Json;
|
||||
using AIStudio.Wpf.Flowchart.Models;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
{
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using Util.DiagramDesigner.Helpers;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using Util.DiagramDesigner.Helpers;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
{
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/Slider.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/TabControl.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/ToggleButton.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Flowchart/ViewModels/FlowNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Logical/ViewModels/LogicalGateItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/BarcodeDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/OutLineTextDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/PathItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/PersistDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/SettingsDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/SvgDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/BarcodeDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/OutLineTextDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/PathItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/PersistDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/SettingsDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Extensions/ViewModels/SvgDesignerItemViewModel.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters">
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters;assembly=AIStudio.Wpf.BaseDiagram">
|
||||
<converter:ThicknessBindingConverter x:Key="ThicknessBindingConverter"/>
|
||||
|
||||
<Style x:Key="DefaultExpanderBaseHeaderStyle" TargetType="{x:Type ToggleButton}">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using AIStudio.Wpf.ADiagram.Commands;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Others;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using AIStudio.Wpf.BaseDiagram.Commands;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.ViewModels;
|
||||
using AIStudio.Wpf.BaseDiagram.Helpers;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -20,14 +20,12 @@ using ZXing;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
{
|
||||
public class DiagramsViewModel : BindableBase
|
||||
public partial class DiagramsViewModel : BindableBase
|
||||
{
|
||||
private IDiagramServiceProvider _service { get { return DiagramServicesProvider.Instance.Provider; } }
|
||||
public MainWindowViewModel MainWindowViewModel { get; set; }
|
||||
|
||||
public DiagramsViewModel(MainWindowViewModel mainWindowViewModel, string title, string status, DiagramType diagramType)
|
||||
public DiagramsViewModel(string title, string status, DiagramType diagramType)
|
||||
{
|
||||
MainWindowViewModel = mainWindowViewModel;
|
||||
Title = title;
|
||||
Status = status;
|
||||
DiagramType = diagramType;
|
||||
@@ -40,9 +38,8 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
|
||||
Init();
|
||||
}
|
||||
public DiagramsViewModel(MainWindowViewModel mainWindowViewModel, string filename)
|
||||
public DiagramsViewModel(string filename)
|
||||
{
|
||||
MainWindowViewModel = mainWindowViewModel;
|
||||
FileName = filename;
|
||||
OpenFile(filename);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AIStudio.Wpf.ADiagram.ViewModels;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -9,15 +10,15 @@ using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Flowchart
|
||||
namespace AIStudio.Wpf.Flowchart
|
||||
{
|
||||
public class FlowchartViewModel : DiagramsViewModel
|
||||
{
|
||||
public FlowchartViewModel(MainWindowViewModel mainWindowViewModel, string title, string status, DiagramType diagramType) : base(mainWindowViewModel, title, status, diagramType)
|
||||
public FlowchartViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||
{
|
||||
|
||||
}
|
||||
public FlowchartViewModel(MainWindowViewModel mainWindowViewModel, string filename) : base(mainWindowViewModel, filename)
|
||||
public FlowchartViewModel(string filename) : base(filename)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
using AIStudio.Wpf.ADiagram.ViewModels;
|
||||
using AIStudio.Wpf.Logical.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Logical
|
||||
namespace AIStudio.Wpf.Logical
|
||||
{
|
||||
public class LogicalViewModel : DiagramsViewModel
|
||||
{
|
||||
public LogicalViewModel(MainWindowViewModel mainWindowViewModel, string title, string status, DiagramType diagramType) : base(mainWindowViewModel, title, status, diagramType)
|
||||
public LogicalViewModel(string title, string status, DiagramType diagramType) : base(title, status, diagramType)
|
||||
{
|
||||
|
||||
}
|
||||
public LogicalViewModel(MainWindowViewModel mainWindowViewModel, string filename) : base(mainWindowViewModel, filename)
|
||||
public LogicalViewModel(string filename) : base(filename)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
using AIStudio.Wpf.ADiagram.Commands;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Logical;
|
||||
using AIStudio.Wpf.ADiagram.Enums;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using AIStudio.Wpf.ADiagram.Views;
|
||||
using AIStudio.Wpf.ADiagram.Views;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.Logical;
|
||||
using ControlzEx.Theming;
|
||||
using Dragablz;
|
||||
using Fluent;
|
||||
@@ -18,6 +15,8 @@ using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.BaseDiagram.Helpers;
|
||||
using AIStudio.Wpf.BaseDiagram.Commands;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
{
|
||||
@@ -32,7 +31,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
|
||||
ConnectorViewModel.PathFinder = new OrthogonalPathFinder();
|
||||
DiagramsViewModels = new ObservableCollection<DiagramsViewModel>();
|
||||
DiagramsViewModels.Add(new DiagramsViewModel(this, "新建-1", "*", DiagramType.Normal));
|
||||
DiagramsViewModels.Add(new DiagramsViewModel("新建-1", "*", DiagramType.Normal));
|
||||
DiagramsViewModel = DiagramsViewModels.FirstOrDefault();
|
||||
|
||||
StandardColor = GenerateStandardGradients();
|
||||
@@ -78,8 +77,8 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private ColorType _colorObject;
|
||||
public ColorType ColorType
|
||||
private Models.ColorType _colorObject;
|
||||
public Models.ColorType ColorType
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -217,7 +216,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
return
|
||||
() =>
|
||||
{
|
||||
return new DiagramsViewModel(this, NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", DiagramType.Normal);
|
||||
return new DiagramsViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", DiagramType.Normal);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -774,7 +773,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
var flow = new DiagramsViewModel(this, filename);
|
||||
var flow = new DiagramsViewModel(filename);
|
||||
DiagramsViewModels.Add(flow);
|
||||
DiagramsViewModel = flow;
|
||||
|
||||
@@ -884,15 +883,15 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
IsOpenBackstage = false;
|
||||
if (type == DiagramType.FlowChart.ToString())
|
||||
{
|
||||
DiagramsViewModel = new FlowchartViewModel(this, NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
DiagramsViewModel = new FlowchartViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
}
|
||||
else if (type == DiagramType.Logical.ToString())
|
||||
{
|
||||
DiagramsViewModel = new LogicalViewModel(this, NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
DiagramsViewModel = new LogicalViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
}
|
||||
else
|
||||
{
|
||||
DiagramsViewModel = new DiagramsViewModel(this, NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
DiagramsViewModel = new DiagramsViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
}
|
||||
|
||||
DiagramsViewModels.Add(DiagramsViewModel);
|
||||
@@ -1135,9 +1134,9 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
|
||||
switch (ColorType)
|
||||
{
|
||||
case ColorType.Text: DiagramsViewModel.SetFont(new FontViewModel() { FontColor = (Color)para }, "FontColor"); break;
|
||||
case ColorType.Fill: DiagramsViewModel.SetColor(new ColorViewModel() { FillColor = new ColorObject() { Color = (Color)para } }, "FillColor"); break;
|
||||
case ColorType.Line: DiagramsViewModel.SetColor(new ColorViewModel() { LineColor = new ColorObject() { Color = (Color)para } }, "LineColor"); break;
|
||||
case Models.ColorType.Text: DiagramsViewModel.SetFont(new FontViewModel() { FontColor = (Color)para }, "FontColor"); break;
|
||||
case Models.ColorType.Fill: DiagramsViewModel.SetColor(new ColorViewModel() { FillColor = new ColorObject() { Color = (Color)para } }, "FillColor"); break;
|
||||
case Models.ColorType.Line: DiagramsViewModel.SetColor(new ColorViewModel() { LineColor = new ColorObject() { Color = (Color)para } }, "LineColor"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using AIStudio.Wpf.BaseDiagram.Commands;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.ViewModels;
|
||||
using AIStudio.Wpf.BaseDiagram.Helpers;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using AIStudio.Wpf.Flowchart;
|
||||
using AIStudio.Wpf.Flowchart.ViewModels;
|
||||
using AIStudio.Wpf.Logical.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
using Util.DiagramDesigner;
|
||||
using Util.DiagramDesigner.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.ObjectModel;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Logical;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Others;
|
||||
using System.Windows.Input;
|
||||
using AIStudio.Wpf.ADiagram.Commands;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using static AIStudio.Wpf.ADiagram.Helpers.NewNameHelper;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
{
|
||||
@@ -195,7 +192,7 @@ namespace AIStudio.Wpf.ADiagram.ViewModels
|
||||
if (Directory.Exists(_svg))
|
||||
{
|
||||
var files = Directory.GetFiles(_svg);
|
||||
foreach (var filename in files.OrderBy(p => p, new NaturalStringComparer()).Where(p => p.ToLower().EndsWith(".svg")))
|
||||
foreach (var filename in files.OrderBy(p => p, new NewNameHelper.NaturalStringComparer()).Where(p => p.ToLower().EndsWith(".svg")))
|
||||
{
|
||||
SvgToolBoxCategory.ToolBoxItems.Add(new SvgToolBoxData(filename, typeof(SvgDesignerItemViewModel)));
|
||||
}
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.ADiagram"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:utilhandy="https://astudio.github.io/utilcontrol.handy"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:views="clr-namespace:AIStudio.Wpf.ADiagram.Views"
|
||||
xmlns:binding="clr-namespace:AIStudio.Wpf.ADiagram.Commands"
|
||||
xmlns:binding="clr-namespace:AIStudio.Wpf.BaseDiagram.Commands;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:controlzEx="urn:controlzex"
|
||||
xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.ADiagram.Helpers"
|
||||
xmlns:enum="clr-namespace:AIStudio.Wpf.ADiagram.Enums"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.BaseDiagram.Helpers;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Models"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:drop="urn:gong-wpf-dragdrop"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.ADiagram.ViewModels"
|
||||
Style="{StaticResource RibbonWindowStyle}"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Icons/App.ico"
|
||||
@@ -1658,7 +1658,7 @@
|
||||
</dragablz:TabablzControl>
|
||||
|
||||
<DockPanel Grid.Row="1" >
|
||||
<Fluent:ComboBox Size="Small" IsEditable="False" helper:EnumHelper.Enum="{x:Type enum:ColorType}" SelectedItem="{Binding ColorType}" BorderThickness="0" BorderBrush="Transparent" Background="Transparent" Template="{StaticResource ComboboxControlTemplate1}" >
|
||||
<Fluent:ComboBox Size="Small" IsEditable="False" helper:EnumHelper.Enum="{x:Type model:ColorType}" SelectedItem="{Binding ColorType}" BorderThickness="0" BorderBrush="Transparent" Background="Transparent" Template="{StaticResource ComboboxControlTemplate1}" >
|
||||
<Fluent:ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<iconPacks:PackIconMaterial x:Name="icon" Kind="FormatColorText" Width="12" Height="12" Margin="2"/>
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:views="clr-namespace:AIStudio.Wpf.ADiagram.Views"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.ADiagram.Helpers"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.BaseDiagram.Helpers;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:flowchart="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Flowchart"
|
||||
xmlns:flowchart="clr-namespace:AIStudio.Wpf.Flowchart;assembly=AIStudio.Wpf.Flowchart"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
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:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:views="clr-namespace:AIStudio.Wpf.ADiagram.Views"
|
||||
xmlns:viewmodels="clr-namespace:AIStudio.Wpf.ADiagram.ViewModels"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Models"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:conventer="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:command="clr-namespace:AIStudio.Wpf.ADiagram.Commands"
|
||||
xmlns:conventer="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:command="clr-namespace:AIStudio.Wpf.BaseDiagram.Commands;assembly=AIStudio.Wpf.BaseDiagram"
|
||||
xmlns:svg="clr-namespace:Svg2XamlTestExtension;assembly=Svg2XamlTestExtension"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
@@ -18,7 +17,7 @@
|
||||
<conventer:StringPathConverter x:Key="stringPathConverter"/>
|
||||
<conventer:IntVisibilityConverter x:Key="IntVisibilityConverter"/>
|
||||
<command:CommandReference x:Key="DeleteItemCommandReference" Command="{Binding DeleteItemCommand}"/>
|
||||
|
||||
|
||||
<DataTemplate DataType="{x:Type model:ImageToolBoxData}">
|
||||
<Grid Width="{Binding Width}" Height="{Binding Height}">
|
||||
<Rectangle Name="Border"
|
||||
@@ -147,7 +146,7 @@
|
||||
TextDecorations="{Binding FontViewModel.TextDecorations}"
|
||||
HorizontalContentAlignment="{Binding FontViewModel.HorizontalAlignment}"
|
||||
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"/>
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"/>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
|
||||
@@ -158,6 +157,26 @@
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type model:FlowchartToolBoxData}">
|
||||
<Grid Width="{Binding Width}" Height="{Binding Height}">
|
||||
<Rectangle Name="Border"
|
||||
StrokeThickness="1"
|
||||
StrokeDashArray="2"
|
||||
Fill="Transparent"
|
||||
SnapsToDevicePixels="true"/>
|
||||
<Viewbox Stretch="Fill">
|
||||
<Grid>
|
||||
<ContentControl Style="{StaticResource CustomFlowNodeStyle}" Margin="2"/>
|
||||
<TextBlock Text="{Binding Text}" Margin="5" Foreground="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type viewmodels:ToolBoxCategory}">
|
||||
<Grid Visibility="{Binding IsChecked,Converter={StaticResource boolToVisibilityConverter}}">
|
||||
|
||||
71
AIStudio.Wpf.BaseDiagram/AIStudio.Wpf.BaseDiagram.csproj
Normal file
71
AIStudio.Wpf.BaseDiagram/AIStudio.Wpf.BaseDiagram.csproj
Normal file
@@ -0,0 +1,71 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fluent.Ribbon" Version="8.0.3" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Util.Svg2XamlTestExtension" Version="1.2.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Util.DiagramDesigner\Util.DiagramDesigner.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\Barcode.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Controls\GradientStopControl.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Controls\MultiSelectComboBox.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Controls\PopupWindow.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Controls\PropertiesView.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Controls\SliderRotation.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\BarcodeDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\OutLineTextDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\PathItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\PersistDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\SettingsDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Extensions\ViewModels\SvgDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="zxing.core">
|
||||
<HintPath>..\AIStudio.Wpf.ADiagram\zxing.core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,11 +1,11 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using AIStudio.Wpf.BaseDiagram.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram
|
||||
namespace AIStudio.Wpf.BaseDiagram
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple service interface
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// This class allows delegating the commanding logic to methods passed as parameters,
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
public class CommandReference : Freezable, ICommand
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// The CompositeCommand composes one or more ICommands.
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
@@ -9,7 +8,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(object))]
|
||||
public class ControlBinding : MarkupExtension
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
#region ConbrolCommand
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="ICommand"/> whose delegates can be attached for <see cref="Execute(T)"/> and <see cref="CanExecute(T)"/>.
|
||||
@@ -5,7 +5,7 @@ using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="ICommand"/> whose delegates do not take any parameters for <see cref="Execute()"/> and <see cref="CanExecute()"/>.
|
||||
@@ -8,7 +8,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="ICommand"/> whose delegates can be attached for <see cref="Execute"/> and <see cref="CanExecute"/>.
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface that defines if the object instance is active
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Provide a way to observe property changes of INotifyPropertyChanged objects and invokes a
|
||||
@@ -6,7 +6,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Commands
|
||||
namespace AIStudio.Wpf.BaseDiagram.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents each node of nested properties expression and takes care of
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 包含一些常用的动画辅助方法
|
||||
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.ADiagram.Controls.Barcode"
|
||||
<UserControl x:Class="AIStudio.Wpf.BaseDiagram.Controls.Barcode"
|
||||
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.ADiagram.Controls"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
@@ -16,7 +16,7 @@ using WpfAnimatedGif;
|
||||
using ZXing;
|
||||
using ZXing.Presentation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Barcode.xaml 的交互逻辑
|
||||
@@ -1,12 +1,12 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.ADiagram.Controls.GradientStopControl"
|
||||
<UserControl x:Class="AIStudio.Wpf.BaseDiagram.Controls.GradientStopControl"
|
||||
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.ADiagram.Controls"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.ADiagram.Helpers"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
|
||||
xmlns:helper="clr-namespace:AIStudio.Wpf.BaseDiagram.Helpers"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
mc:Ignorable="d"
|
||||
@@ -14,7 +14,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// GradientStopControl.xaml 的交互逻辑
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.ADiagram.Controls.MultiSelectComboBox"
|
||||
<UserControl x:Class="AIStudio.Wpf.BaseDiagram.Controls.MultiSelectComboBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ComboBox Background="Transparent" BorderBrush="Transparent"
|
||||
@@ -14,10 +14,10 @@ using System.Windows.Shapes;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Collections;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using AIStudio.Wpf.BaseDiagram.Helpers;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MultiSelectComboBox.xaml
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
public class OutlineText : FrameworkElement
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="AIStudio.Wpf.ADiagram.Controls.PopupWindow"
|
||||
<Window x:Class="AIStudio.Wpf.BaseDiagram.Controls.PopupWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="{Binding Title}"
|
||||
@@ -12,7 +12,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// PopupWindow.xaml 的交互逻辑
|
||||
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.ADiagram.Controls.PropertiesView"
|
||||
<UserControl x:Class="AIStudio.Wpf.BaseDiagram.Controls.PropertiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ControlTemplate x:Key="validationErrorTemplate">
|
||||
<DockPanel>
|
||||
<Image Source="/AIStudio.Wpf.ADiagram;component/Images/error.png" Height="16" Width="16"
|
||||
<Image Source="/AIStudio.Wpf.BaseDiagram;component/Images/error.png" Height="16" Width="16"
|
||||
DockPanel.Dock="Right" Margin="-18,0,0,0"
|
||||
ToolTip="{Binding ElementName=adorner,
|
||||
Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
|
||||
@@ -14,7 +14,7 @@ using System.Windows.Shapes;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertiesView.xaml
|
||||
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
public class RectangleGridEventArgs
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<UserControl x:Class="AIStudio.Wpf.ADiagram.Controls.SliderRotation"
|
||||
<UserControl x:Class="AIStudio.Wpf.BaseDiagram.Controls.SliderRotation"
|
||||
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.ADiagram.Controls"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Name="sliderRotation"
|
||||
@@ -12,7 +12,7 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// SliderRotation.xaml 的交互逻辑
|
||||
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
namespace AIStudio.Wpf.BaseDiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// A ruler control which supports both centimeters and inches. In order to use it vertically, change the <see cref="Marks">Marks</see> property to <c>Up</c> and rotate it ninety degrees.
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class BoolVisibilityConverter : IValueConverter
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class Boolean2VisibilityReConverter : IValueConverter
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ConverterBoolToValueMap : MarkupExtension, IValueConverter
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ConverterValueMapSetToVisibility : MarkupExtension, IValueConverter
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ConverterValueMapToBool : MarkupExtension, IValueConverter
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ConverterValueMapToVisibility : MarkupExtension, IValueConverter
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ConverterValueSetToOppositeVisibility : MarkupExtension, IValueConverter
|
||||
{
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using AIStudio.Wpf.ADiagram.Controls;
|
||||
using AIStudio.Wpf.BaseDiagram.Controls;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class CountShiftConverter : IMultiValueConverter
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class DoubleToThickness : IValueConverter
|
||||
{
|
||||
@@ -21,7 +21,7 @@ using System.Text;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
class HtmlColorConverter : IValueConverter
|
||||
{
|
||||
@@ -9,7 +9,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class IndentConverter : IValueConverter
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
//选中项索引转换成可见项
|
||||
public class IntVisibilityConverter : MarkupExtension, IValueConverter
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class NullableToBooleanConverter : IValueConverter
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class NullableToVisibilityConverter : IValueConverter
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class NumberConverter : IValueConverter
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
using AIStudio.Wpf.ADiagram.Controls;
|
||||
using AIStudio.Wpf.BaseDiagram.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class RulerUnitConverter : IValueConverter
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class StringPathConverter : IValueConverter
|
||||
{
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a Thickness to a new Thickness. It's possible to ignore a side With the IgnoreThicknessSide property.
|
||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
namespace AIStudio.Wpf.BaseDiagram.Converters
|
||||
{
|
||||
public class ThicknessToDoubleConverter : IValueConverter
|
||||
{
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Util.DiagramDesigner;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.Models
|
||||
{
|
||||
public class PathDesignerItem : DesignerItemBase
|
||||
{
|
||||
@@ -1,12 +1,8 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.Models
|
||||
{
|
||||
public class PersistDesignerItem : DesignerItemBase
|
||||
{
|
||||
@@ -1,13 +1,9 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.ViewModels;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.Models
|
||||
{
|
||||
public class SettingsDesignerItem : DesignerItemBase
|
||||
public class SettingsDesignerItem : DesignerItemBase
|
||||
{
|
||||
public SettingsDesignerItem()
|
||||
{
|
||||
@@ -1,16 +1,9 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using AIStudio.Wpf.ADiagram.Commands;
|
||||
using AIStudio.Wpf.BaseDiagram.Commands;
|
||||
using AIStudio.Wpf.BaseDiagram.Models;
|
||||
using System.Windows.Input;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using ZXing;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class BarcodeDesignerItemData : TitleBindableBase
|
||||
{
|
||||
@@ -1,17 +1,9 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.BaseDiagram.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using System.Globalization;
|
||||
using Util.DiagramDesigner;
|
||||
using ZXing;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class BarcodeDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
@@ -14,14 +14,14 @@
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter"/>
|
||||
|
||||
|
||||
<DataTemplate DataType="{x:Type model:BarcodeDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:BarcodeDesignerItemViewModel}">
|
||||
<Viewbox Stretch="Fill" IsHitTestVisible="False">
|
||||
<controls:Barcode Width="{Binding ItemWidth}" Height="{Binding ItemHeight}" Padding="{Binding Margin,Converter={StaticResource DoubleToThickness}}" Text="{Binding Text}" Icon="{Binding Icon}" Format="{Binding Format}"/>
|
||||
</Viewbox>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- DataTemplate for Popup look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:BarcodeDesignerItemData}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:BarcodeDesignerItemData}">
|
||||
<Grid Width="550">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -1,13 +1,7 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using AIStudio.Wpf.BaseDiagram.Models;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class OutLineTextDesignerItemData : TitleBindableBase
|
||||
{
|
||||
@@ -1,16 +1,10 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using AIStudio.Wpf.BaseDiagram.Services;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class OutLineTextDesignerItemViewModel : TextDesignerItemViewModel
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
@@ -13,7 +13,7 @@
|
||||
<converter:DoubleToThickness x:Key="DoubleToThickness"/>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter"/>
|
||||
|
||||
<DataTemplate DataType="{x:Type model:OutLineTextDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:OutLineTextDesignerItemViewModel}">
|
||||
<Viewbox Stretch="Fill" IsHitTestVisible="False">
|
||||
<controls:OutlineText StrokePosition="Outside"
|
||||
Text="{Binding Text}"
|
||||
@@ -30,7 +30,7 @@
|
||||
</DataTemplate>
|
||||
|
||||
<!-- DataTemplate for Popup look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:OutLineTextDesignerItemData}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:OutLineTextDesignerItemData}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -91,19 +91,19 @@
|
||||
</Fluent:ComboBox>
|
||||
<Fluent:ToggleButton KeyTip="B"
|
||||
x:Name="buttonBold"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Images/Bold.png"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Images/Bold.png"
|
||||
HorizontalAlignment="Left"
|
||||
SizeDefinition="Small"
|
||||
IsChecked="{Binding FontViewModel.FontWeight,Converter={converter:ConverterValueMapToBool Parameter='Regular'}, ConverterParameter='Bold'}"/>
|
||||
<Fluent:ToggleButton x:Name="buttonItalic"
|
||||
KeyTip="I"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Images/Italic.png"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Images/Italic.png"
|
||||
HorizontalAlignment="Left"
|
||||
SizeDefinition="Small"
|
||||
IsChecked="{Binding FontViewModel.FontStyle,Converter={converter:ConverterValueMapToBool Parameter='Normal'}, ConverterParameter='Italic'}"/>
|
||||
<Fluent:ToggleButton x:Name="buttonUnderline"
|
||||
KeyTip="U"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Images/Underline.png"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.BaseDiagram;component/Images/Underline.png"
|
||||
HorizontalAlignment="Left"
|
||||
SizeDefinition="Small"
|
||||
IsChecked="{Binding FontViewModel.Underline}"/>
|
||||
@@ -1,12 +1,6 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class PathItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:convent="clr-namespace:AIStudio.Wpf.ADiagram.Converters">
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:convent="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters">
|
||||
<convent:StringPathConverter x:Key="stringPathConverter"/>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<Brush x:Key="ItemStroke">#FFD69436</Brush>
|
||||
@@ -25,7 +25,7 @@
|
||||
<Setter Property="Data" Value="{Binding Icon,Converter={StaticResource stringPathConverter}}"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate DataType="{x:Type model:PathItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:PathItemViewModel}">
|
||||
<Grid>
|
||||
<Path Tag="Process" IsHitTestVisible="False" Style="{StaticResource PathItemStyle}"/>
|
||||
</Grid>
|
||||
@@ -1,12 +1,6 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using AIStudio.Wpf.BaseDiagram.Models;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// This is passed to the PopupWindow.xaml window, where a DataTemplate is used to provide the
|
||||
@@ -1,14 +1,8 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using AIStudio.Wpf.BaseDiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.Models;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class PersistDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
@@ -44,11 +44,11 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- DataTemplate for DesignerCanvas look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:PersistDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:PersistDesignerItemViewModel}">
|
||||
<Grid>
|
||||
<Image IsHitTestVisible="False"
|
||||
Stretch="Fill"
|
||||
Source="/AIStudio.Wpf.ADiagram;component/Images/Persist.png"
|
||||
Source="/AIStudio.Wpf.BaseDiagram;component/Images/Persist.png"
|
||||
Tag="setting" />
|
||||
<Button x:Name="btnSetting" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
@@ -59,7 +59,7 @@
|
||||
</DataTemplate>
|
||||
|
||||
<!-- DataTemplate for Popup look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:PersistDesignerItemData}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:PersistDesignerItemData}">
|
||||
<Grid Background="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -1,12 +1,6 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AIStudio.Wpf.ADiagram.Models;
|
||||
using AIStudio.Wpf.BaseDiagram.Models;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// This is passed to the PopupWindow.xaml window, where a DataTemplate is used to provide the
|
||||
@@ -1,14 +1,9 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.BaseDiagram.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.BaseDiagram.Extensions.Models;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class SettingsDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.ADiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
|
||||
xmlns:dd="https://astudio.github.io/diagram"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
@@ -44,11 +44,11 @@
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- DataTemplate for DesignerCanvas look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:SettingsDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:SettingsDesignerItemViewModel}">
|
||||
<Grid>
|
||||
<Image IsHitTestVisible="False"
|
||||
Stretch="Fill"
|
||||
Source="/AIStudio.Wpf.ADiagram;component/Images/Setting.png"
|
||||
Source="/AIStudio.Wpf.BaseDiagram;component/Images/Setting.png"
|
||||
Tag="setting" />
|
||||
<Button HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
@@ -59,7 +59,7 @@
|
||||
</DataTemplate>
|
||||
|
||||
<!-- DataTemplate for Popup look and feel -->
|
||||
<DataTemplate DataType="{x:Type model:SettingsDesignerItemData}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:SettingsDesignerItemData}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Util.DiagramDesigner;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
namespace AIStudio.Wpf.BaseDiagram.Extensions.ViewModels
|
||||
{
|
||||
public class SvgDesignerItemViewModel: MediaItemViewModel
|
||||
{
|
||||
@@ -1,11 +1,11 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
|
||||
xmlns:model="clr-namespace:AIStudio.Wpf.ADiagram.Demos.Others"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
|
||||
xmlns:svg="clr-namespace:Svg2XamlTestExtension;assembly=Svg2XamlTestExtension">
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
|
||||
<DataTemplate DataType="{x:Type model:SvgDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type viewmodel:SvgDesignerItemViewModel}">
|
||||
<Grid IsHitTestVisible="False">
|
||||
<svg:PackSvg Width="Auto" Height="Auto" Path="{Binding Icon}" Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"/>
|
||||
</Grid>
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Helpers
|
||||
namespace AIStudio.Wpf.BaseDiagram.Helpers
|
||||
{
|
||||
public class EnumHelper : DependencyObject
|
||||
{
|
||||
@@ -7,7 +7,7 @@ using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Helpers
|
||||
namespace AIStudio.Wpf.BaseDiagram.Helpers
|
||||
{
|
||||
public class NewNameHelper
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Helpers
|
||||
namespace AIStudio.Wpf.BaseDiagram.Helpers
|
||||
{
|
||||
public class TypeHelper
|
||||
{
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Helpers
|
||||
namespace AIStudio.Wpf.BaseDiagram.Helpers
|
||||
{
|
||||
public class XmlSerializeHelper
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
namespace AIStudio.Wpf.BaseDiagram.Models
|
||||
{
|
||||
public class TitleBindableBase : BindableBase
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Services
|
||||
namespace AIStudio.Wpf.BaseDiagram.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Available Button options.
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Services
|
||||
namespace AIStudio.Wpf.BaseDiagram.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface defines a UI controller which can be used to display dialogs
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Services
|
||||
namespace AIStudio.Wpf.BaseDiagram.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IMessageBoxService for WPF purposes.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user