年度变更建库软件5.0版本
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.
 
 

38 lines
969 B

using System;
using System.Windows;
using System.Windows.Data;
namespace Kingo.Plugin.NYYP
{
sealed class DependencyVariable<T>
: DependencyObject
{
static readonly DependencyProperty valueProperty =
DependencyProperty.Register(
"Value",
typeof(T),
typeof(DependencyVariable<T>)
);
public static DependencyProperty ValueProperty
{
get { return valueProperty; }
}
public T Value
{
get { return (T)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public void SetBinding(Binding binding)
{
BindingOperations.SetBinding(this, ValueProperty, binding);
}
public void SetBinding(object dataContext, string propertyPath)
{
SetBinding(new Binding(propertyPath) { Source = dataContext });
}
}
}