72 lines
1.5 KiB
C#
72 lines
1.5 KiB
C#
using System.ComponentModel;
|
|
|
|
namespace Lattice.Example.DragDrop;
|
|
|
|
public class DragDropItem : INotifyPropertyChanged
|
|
{
|
|
private string _name = string.Empty;
|
|
private string _description = string.Empty;
|
|
private string _icon = string.Empty;
|
|
private string _type = string.Empty;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
public string Name
|
|
{
|
|
get => _name;
|
|
set
|
|
{
|
|
if (_name != value)
|
|
{
|
|
_name = value;
|
|
OnPropertyChanged(nameof(Name));
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Description
|
|
{
|
|
get => _description;
|
|
set
|
|
{
|
|
if (_description != value)
|
|
{
|
|
_description = value;
|
|
OnPropertyChanged(nameof(Description));
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Icon
|
|
{
|
|
get => _icon;
|
|
set
|
|
{
|
|
if (_icon != value)
|
|
{
|
|
_icon = value;
|
|
OnPropertyChanged(nameof(Icon));
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Type
|
|
{
|
|
get => _type;
|
|
set
|
|
{
|
|
if (_type != value)
|
|
{
|
|
_type = value;
|
|
OnPropertyChanged(nameof(Type));
|
|
}
|
|
}
|
|
}
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
public override string ToString() => $"{Name} ({Type})";
|
|
} |