Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions samples/NodeEditor.Base/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
IsVisible="{Binding IsToolboxVisible}">
<Separator Classes="vertical" DockPanel.Dock="Right" />
<editor:Toolbox TemplatesSource="{Binding Editor.Templates}"
DrawingSource="{Binding Editor.Drawing}"
Name="ToolboxView" />
</DockPanel>
<ThemeVariantScope RequestedThemeVariant="Light"
Expand Down
9 changes: 9 additions & 0 deletions src/NodeEditorAvalonia/Controls/Toolbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ public class Toolbox : TemplatedControl
public static readonly StyledProperty<IEnumerable<INodeTemplate>?> TemplatesSourceProperty =
AvaloniaProperty.Register<Toolbox, IEnumerable<INodeTemplate>?>(nameof(TemplatesSource));

public static readonly StyledProperty<IDrawingNode?> DrawingSourceProperty =
AvaloniaProperty.Register<Toolbox, IDrawingNode?>(nameof(DrawingSource));

public IDrawingNode? DrawingSource
{
get => GetValue(DrawingSourceProperty);
set => SetValue(DrawingSourceProperty, value);
}

public IEnumerable<INodeTemplate>? TemplatesSource
{
get => GetValue(TemplatesSourceProperty);
Expand Down
3 changes: 2 additions & 1 deletion src/NodeEditorAvalonia/Themes/Controls/Toolbox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
<i:BehaviorCollectionTemplate>
<i:BehaviorCollection>
<idd:ContextDragBehavior />
<behaviors:InsertTemplateOnDoubleTappedBehavior />
<behaviors:InsertTemplateOnDoubleTappedBehavior
DrawingSource="{Binding DrawingSource, RelativeSource={RelativeSource TemplatedParent}}" />
</i:BehaviorCollection>
</i:BehaviorCollectionTemplate>
</Setter>
Expand Down