2023-01-23 22:05:51 +08:00
|
|
|
<UserControl x:Class="AIStudio.Wpf.DiagramDesigner.LineControl"
|
|
|
|
|
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"
|
2023-03-05 21:30:53 +08:00
|
|
|
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
2023-01-23 22:05:51 +08:00
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
|
|
|
<UserControl.Resources>
|
2023-03-05 21:30:53 +08:00
|
|
|
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
|
|
|
|
<dd:LineDashConverter x:Key="LineDashConverter"/>
|
|
|
|
|
<dd:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
|
|
|
|
<dd:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
|
|
|
|
<dd:MathConverter x:Key="MathAddConverter" Operation="Add" />
|
2023-04-15 21:55:27 +08:00
|
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
|
|
|
|
2023-01-25 14:42:01 +08:00
|
|
|
<Style x:Key="LineStyle" TargetType="Path">
|
|
|
|
|
<Setter Property="Stroke" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Value="True" Binding="{Binding IsSelected}">
|
|
|
|
|
<Setter Property="Stroke" Value="Black"/>
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
|
|
|
|
<Style x:Key="ArrowStyle" TargetType="Path">
|
2023-01-26 18:42:58 +08:00
|
|
|
<!--<Setter Property="Stroke" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>-->
|
2023-01-25 14:42:01 +08:00
|
|
|
<Setter Property="Fill" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<DataTrigger Value="True" Binding="{Binding IsSelected}">
|
2023-01-26 18:42:58 +08:00
|
|
|
<!--<Setter Property="Stroke" Value="Black"/>-->
|
2023-01-25 14:42:01 +08:00
|
|
|
<Setter Property="Fill" Value="Black"/>
|
|
|
|
|
</DataTrigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
2023-01-23 22:05:51 +08:00
|
|
|
</UserControl.Resources>
|
|
|
|
|
<Grid>
|
|
|
|
|
<Canvas x:Name="rootCanvas">
|
2023-01-25 14:42:01 +08:00
|
|
|
<Path x:Name="line" StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
|
|
|
|
StrokeDashArray="{Binding ColorViewModel.LineDashStyle,Converter={StaticResource LineDashConverter}}"
|
2023-02-10 18:49:02 +08:00
|
|
|
Style="{StaticResource LineStyle}"
|
|
|
|
|
StrokeLineJoin="Round"
|
|
|
|
|
StrokeStartLineCap="Round"
|
|
|
|
|
StrokeEndLineCap="Round">
|
2023-01-23 22:05:51 +08:00
|
|
|
<Path.Data>
|
2023-03-05 21:30:53 +08:00
|
|
|
<MultiBinding Converter="{x:Static dd:ConnectionPathConverter.Instance}">
|
2023-01-23 22:05:51 +08:00
|
|
|
<Binding Path="PathGeneratorResult"/>
|
|
|
|
|
</MultiBinding>
|
|
|
|
|
</Path.Data>
|
|
|
|
|
</Path>
|
|
|
|
|
|
2023-02-04 12:17:03 +08:00
|
|
|
<Grid Canvas.Left="{Binding EndRectangle.Left}"
|
|
|
|
|
Canvas.Top="{Binding EndRectangle.Top}"
|
|
|
|
|
Width="{Binding EndRectangle.Width}"
|
|
|
|
|
Height="{Binding EndRectangle.Height}">
|
|
|
|
|
<Path x:Name="rightarrow"
|
|
|
|
|
Data="{Binding ShapeViewModel.SinkMarker.Path}"
|
|
|
|
|
Width="{Binding ShapeViewModel.SinkMarker.Width}"
|
|
|
|
|
Height="{Binding ShapeViewModel.SinkMarker.Height}"
|
|
|
|
|
Stretch="Fill"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
|
|
|
|
Style="{StaticResource ArrowStyle}">
|
|
|
|
|
<Path.RenderTransform>
|
|
|
|
|
<TransformGroup>
|
|
|
|
|
<RotateTransform Angle="{Binding EndAngle}"/>
|
|
|
|
|
</TransformGroup>
|
|
|
|
|
</Path.RenderTransform>
|
|
|
|
|
</Path>
|
|
|
|
|
</Grid>
|
2023-01-25 14:42:01 +08:00
|
|
|
|
2023-02-04 12:17:03 +08:00
|
|
|
<Grid Canvas.Left="{Binding StartRectangle.Left}"
|
|
|
|
|
Canvas.Top="{Binding StartRectangle.Top}"
|
|
|
|
|
Width="{Binding StartRectangle.Width}"
|
|
|
|
|
Height="{Binding StartRectangle.Height}">
|
|
|
|
|
<Path x:Name="leftarrow"
|
|
|
|
|
Data="{Binding ShapeViewModel.SourceMarker.Path}"
|
|
|
|
|
Width="{Binding ShapeViewModel.SourceMarker.Width}"
|
|
|
|
|
Height="{Binding ShapeViewModel.SourceMarker.Height}"
|
|
|
|
|
Stretch="Fill"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
|
RenderTransformOrigin="0.5,0.5"
|
|
|
|
|
Style="{StaticResource ArrowStyle}">
|
|
|
|
|
<Path.RenderTransform>
|
|
|
|
|
<TransformGroup>
|
|
|
|
|
<RotateTransform Angle="{Binding StartAngle}"/>
|
|
|
|
|
</TransformGroup>
|
|
|
|
|
</Path.RenderTransform>
|
|
|
|
|
</Path>
|
|
|
|
|
</Grid>
|
2023-01-23 22:05:51 +08:00
|
|
|
|
2023-04-15 21:55:27 +08:00
|
|
|
<Rectangle Canvas.Left="{Binding StartPoint.X}"
|
|
|
|
|
Canvas.Top="{Binding StartPoint.Y}"
|
|
|
|
|
Fill="DarkRed"
|
|
|
|
|
Width="{Binding SourceConnectorInfo.ConnectorWidth}"
|
|
|
|
|
Height="{Binding SourceConnectorInfo.ConnectorHeight}"
|
|
|
|
|
Visibility="{Binding IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
|
|
|
|
|
|
|
|
<Ellipse Canvas.Left="{Binding EndPoint.X}"
|
|
|
|
|
Canvas.Top="{Binding EndPoint.Y}"
|
|
|
|
|
Fill="DarkRed"
|
|
|
|
|
Width="{Binding SinkConnectorInfo.ConnectorWidth}"
|
|
|
|
|
Height="{Binding SinkConnectorInfo.ConnectorHeight}"
|
|
|
|
|
Visibility="{Binding IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
|
|
|
|
2023-04-29 15:29:22 +08:00
|
|
|
<Path x:Name="ball"
|
|
|
|
|
Stretch="Fill"
|
|
|
|
|
Data="{Binding AnimationViewModel.Path}"
|
|
|
|
|
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
2023-01-25 14:42:01 +08:00
|
|
|
Width="{Binding ColorViewModel.LineWidth,Converter={StaticResource MathAddConverter},ConverterParameter=4}"
|
|
|
|
|
Height="{Binding ColorViewModel.LineWidth,Converter={StaticResource MathAddConverter},ConverterParameter=4}"
|
|
|
|
|
Panel.ZIndex="1" />
|
2023-01-23 22:05:51 +08:00
|
|
|
</Canvas>
|
|
|
|
|
</Grid>
|
|
|
|
|
</UserControl>
|