日期:2014-05-17 浏览次数:21120 次
public class AttachedPropertyHelper
{
public static DependencyProperty IsLeafProperty = DependencyProperty.RegisterAttached(
"IsLeaf",
typeof(bool),
typeof(AttachedPropertyHelper),
new FrameworkPropertyMetadata(null)
);
public static void SetIsLeaf(DependencyObject obj, bool value)
{
obj.SetValue(AttachedPropertyHelper.IsLeafProperty, value);
}
public static bool GetIsLeaf(DependencyObject obj)
{
return (bool)obj.GetValue(AttachedPropertyHelper.IsLeafProperty);
}
public static DependencyProperty MouseDoubleClickProperty = DependencyProperty.RegisterAttached(
"MouseDoubleClick",
typeof(ICommand),
typeof(AttachedPropertyHelper),
new FrameworkPropertyMetadata(null, new PropertyChangedCallback(MouseDoubleChanged))
);
public static void SetMouseDoubleClick(DependencyObject obj, ICommand value)
{
obj.SetValue(AttachedPropertyHelper.MouseDoubleClickProperty, value);
}
public static ICommand GetMouseDoubleClick(DependencyObject obj)
{
return (ICommand)obj.GetValue(AttachedPropertyHelper.MouseDoubleClickProperty);