diff --git a/NodifyM.Avalonia.Example/MainWindowViewModel.cs b/NodifyM.Avalonia.Example/MainWindowViewModel.cs index fd7f86f..6a15d7d 100644 --- a/NodifyM.Avalonia.Example/MainWindowViewModel.cs +++ b/NodifyM.Avalonia.Example/MainWindowViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using Avalonia; +using Avalonia.Controls; using Avalonia.Styling; using CommunityToolkit.Mvvm.Input; using NodifyM.Avalonia.ViewModelBase; @@ -27,16 +28,25 @@ public MainWindowViewModel() Connections.Add(new ConnectionViewModelBase(this,output1,knot1.Connector,"Test")); Connections.Add(new ConnectionViewModelBase(this,knot1.Connector,input1)); Nodes =new(){ + new NodeViewModelBase() { Location = new Point(400, 2000), Title = "Node 1", - Input = new ObservableCollection + Input = new ObservableCollection { input1, - + new ComboBox() + { + ItemsSource = new ObservableCollection + { + "Item 1", + "Item 2", + "Item 3" + } + } }, - Output = new ObservableCollection + Output = new ObservableCollection { new ConnectorViewModelBase() @@ -50,7 +60,7 @@ public MainWindowViewModel() { Title = "Node 2", Location = new Point(-100,-100), - Input = new ObservableCollection + Input = new ObservableCollection { new ConnectorViewModelBase() { @@ -63,7 +73,7 @@ public MainWindowViewModel() Title = "Input 2" } }, - Output = new ObservableCollection + Output = new ObservableCollection { output1, new ConnectorViewModelBase() diff --git a/NodifyM.Avalonia/Controls/BaseNode.axaml.cs b/NodifyM.Avalonia/Controls/BaseNode.axaml.cs index fce7b8e..e3e8cde 100644 --- a/NodifyM.Avalonia/Controls/BaseNode.axaml.cs +++ b/NodifyM.Avalonia/Controls/BaseNode.axaml.cs @@ -64,11 +64,25 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e) protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); + if (e.Handled) { return; } + if (e.Source is Control control) + { + if (control is ComboBox) + { + return; + } + + if (control.TemplatedParent is ComboBox) + { + return; + } + } + _editor.SelectItem(this); if (!e.GetCurrentPoint(this) .Properties.IsLeftButtonPressed) return; diff --git a/NodifyM.Avalonia/ViewModelBase/ConnectorViewModelBase.cs b/NodifyM.Avalonia/ViewModelBase/ConnectorViewModelBase.cs index e37bb91..8bc95e9 100644 --- a/NodifyM.Avalonia/ViewModelBase/ConnectorViewModelBase.cs +++ b/NodifyM.Avalonia/ViewModelBase/ConnectorViewModelBase.cs @@ -17,5 +17,7 @@ public enum ConnectorFlow private string _title; [ObservableProperty] private bool _isConnected; + [ObservableProperty] + private bool _canConnect; public ConnectorFlow? Flow { get; set; } } \ No newline at end of file diff --git a/NodifyM.Avalonia/ViewModelBase/NodeViewModelBase.cs b/NodifyM.Avalonia/ViewModelBase/NodeViewModelBase.cs index 8d22f4e..ebc80f5 100644 --- a/NodifyM.Avalonia/ViewModelBase/NodeViewModelBase.cs +++ b/NodifyM.Avalonia/ViewModelBase/NodeViewModelBase.cs @@ -9,6 +9,6 @@ public partial class NodeViewModelBase : BaseNodeViewModel [ObservableProperty] private string _title; [ObservableProperty] private string _footer; - [ObservableProperty] private ObservableCollection input = new(); - [ObservableProperty] private ObservableCollection output = new(); + [ObservableProperty] private ObservableCollection input = new(); + [ObservableProperty] private ObservableCollection output = new(); } \ No newline at end of file