解决TreeView的TreeView_SelectedItemChanged事件被多次调用的问题
This commit is contained in:
49
DMS.WPF/ViewModels/Items/OpcUaNodeItemViewModel.cs
Normal file
49
DMS.WPF/ViewModels/Items/OpcUaNodeItemViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using DMS.Infrastructure.Models;
|
||||
using Opc.Ua;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace DMS.WPF.ViewModels.Items
|
||||
{
|
||||
/// <summary>
|
||||
/// OPC UA节点的视图模型。
|
||||
/// </summary>
|
||||
public partial class OpcUaNodeItemViewModel : ObservableObject
|
||||
{
|
||||
|
||||
[ObservableProperty]
|
||||
private NodeId? _nodeId;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? _displayName;
|
||||
|
||||
[ObservableProperty]
|
||||
private NodeClass _nodeClass;
|
||||
|
||||
[ObservableProperty]
|
||||
private object? _value;
|
||||
|
||||
[ObservableProperty]
|
||||
private OpcUaNodeItemViewModel? _parentNode;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<OpcUaNodeItemViewModel> _children = new ObservableCollection<OpcUaNodeItemViewModel>();
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isExpanded;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isSelected;
|
||||
|
||||
/// <summary>
|
||||
/// 默认构造函数(用于设计时支持)。
|
||||
/// </summary>
|
||||
public OpcUaNodeItemViewModel()
|
||||
{
|
||||
// 设计时数据支持
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user