mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
73 lines
4.0 KiB
XML
73 lines
4.0 KiB
XML
<UserControl x:Class="AIStudio.Wpf.Flowchart.Controls.ToolBoxControl"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:dd="https://gitee.com/akwkevin/aistudio.-wpf.-diagram"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="300" d:DesignWidth="300">
|
|
<UserControl.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
</ResourceDictionary>
|
|
</UserControl.Resources>
|
|
<Border BorderBrush="LightGray" BorderThickness="1">
|
|
<ItemsControl ItemsSource="{Binding ToolBoxItems}">
|
|
<ItemsControl.Template>
|
|
<ControlTemplate TargetType="{x:Type ItemsControl}">
|
|
<Border BorderThickness="{TemplateBinding Border.BorderThickness}"
|
|
Padding="{TemplateBinding Control.Padding}"
|
|
BorderBrush="{TemplateBinding Border.BorderBrush}"
|
|
Background="{TemplateBinding Panel.Background}"
|
|
SnapsToDevicePixels="True">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
|
|
</ScrollViewer>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</ItemsControl.Template>
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemContainerStyle>
|
|
<Style TargetType="{x:Type ContentPresenter}">
|
|
<Setter Property="Control.Padding"
|
|
Value="10" />
|
|
<Setter Property="ContentControl.HorizontalContentAlignment"
|
|
Value="Stretch" />
|
|
<Setter Property="ContentControl.VerticalContentAlignment"
|
|
Value="Stretch" />
|
|
<Setter Property="ToolTip"
|
|
Value="{Binding ToolTip}" />
|
|
<Setter Property="dd:DragAndDropProps.EnabledForDrag"
|
|
Value="True" />
|
|
</Style>
|
|
</ItemsControl.ItemContainerStyle>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid Margin="5" Width="{Binding Width}" Height="{Binding Height}">
|
|
<Rectangle Name="Border"
|
|
StrokeThickness="1"
|
|
StrokeDashArray="2"
|
|
Fill="Transparent"
|
|
SnapsToDevicePixels="true"/>
|
|
<Grid IsHitTestVisible="False">
|
|
<ContentControl Style="{StaticResource CustomFlowNodeStyle}" Margin="2"/>
|
|
<TextBlock Text="{Binding Text}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" />
|
|
</Grid>
|
|
</Grid>
|
|
<DataTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter TargetName="Border" Property="Stroke" Value="Gray"/>
|
|
</Trigger>
|
|
</DataTemplate.Triggers>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Border>
|
|
</UserControl>
|