csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Avalonia.Input
|
|
{
|
|
/// <summary>
|
|
/// Specific and mutable implementation of the IDataObject interface.
|
|
/// </summary>
|
|
[Obsolete($"Use {nameof(DataTransfer)} instead")]
|
|
public class DataObject : IDataObject
|
|
{
|
|
private readonly Dictionary<string, object> _items = new();
|
|
|
|
/// <inheritdoc />
|
|
public bool Contains(string dataFormat)
|
|
{
|
|
return _items.ContainsKey(dataFormat);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public object? Get(string dataFormat)
|
|
{
|
|
return _items.TryGetValue(dataFormat, out var item) ? item : null;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<string> GetDataFormats()
|
|
{
|
|
return _items.Keys;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets a value to the internal store of the data object with <see cref="DataFormats"/> as a key.
|
|
/// </summary>
|
|
public void Set(string dataFormat, object value)
|
|
{
|
|
_items[dataFormat] = value;
|
|
}
|
|
}
|
|
}
|
|
|