//------------------------------------------------------------------------------
// 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
// 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
// CSDN博客:https://blog.csdn.net/qq_40374647
// 哔哩哔哩视频:https://space.bilibili.com/94253567
// Gitee源代码仓库:https://gitee.com/RRQM_Home
// Github源代码仓库:https://github.com/RRQM
// API首页:https://www.yuque.com/rrqm/touchsocket/index
// 交流QQ群:234762506
// 感谢您的下载和使用
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
using System;
using System.Diagnostics;
namespace TouchSocket.Core
{
///
/// IDependencyProperty
///
///
public interface IDependencyProperty
{
///
/// 默认值
///
TValue DefauleValue { get; }
///
/// 属性名称
///
string Name { get; }
///
/// 所属类型
///
Type Owner { get; }
}
///
/// 依赖项属性
///
[DebuggerDisplay("Name={Name},Type={ValueType}")]
public class DependencyProperty : IDependencyProperty
{
///
/// 属性名称
///
protected string m_name;
///
/// 所属类型
///
protected Type m_owner;
private TValue m_value;
///
/// 依赖项属性
///
protected DependencyProperty()
{
}
///
///
///
public TValue DefauleValue => m_value;
///
///
///
public string Name => m_name;
///
///
///
public Type Owner => m_owner;
///
/// 注册依赖项属性。
/// 依赖属性的默认值,可能会应用于所有的
///
///
///
/// 依赖项属性值,一般该值应该是值类型,因为它可能会被用于多个依赖对象。
///
public static DependencyProperty Register(string propertyName, Type owner, TValue value)
{
DependencyProperty dp = new DependencyProperty
{
m_name = propertyName,
m_owner = owner,
m_value = value
};
return dp;
}
}
}