110,532
社区成员
发帖
与我相关
我的任务
分享
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);
}
public static void MouseDoubleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Control control = d as ContentControl;
if (control != null)
{
if (e.NewValue != null && e.OldValue == null)
{
control.MouseDoubleClick += new MouseButtonEventHandler(control_MouseDoubleClick);
}
else if (e.NewValue == null && e.OldValue != null)
{
control.MouseDoubleClick -= new MouseButtonEventHandler(control_MouseDoubleClick);
}
}
}
public static void control_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
Control control = sender as Control;
ICommand command = (ICommand)control.GetValue(AttachedPropertyHelper.MouseDoubleClickProperty);
if (command.CanExecute(control.GetValue(AttachedPropertyHelper.IsLeafProperty)))
{
command.Execute(control);
}
}
}
#include <stdio.h>
void main()
{
double a,b ,c,d;
d=18.0;
c=(a+b+d)*9/26;
b=(a+c+d)*6/9;
a=(b+c+d)*3/11;
a=((a+c+d)*6/9+(a+b+d)*9/26+d)*3/11;
printf("%lf\n",a);
}
#include <stdio.h>
void main()
{
double a,b ,c,d;
d=18.0;
c=(a+b+d)*9/26;
b=(a+c+d)*6/9;
a=(b+c+d)*3/11;
a=((a+c+d)*6/9+(a+b+d)*9/26+d)*3/11;
printf("%lf\n",a);
}
public static void control_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
Control control = sender as Control;
ICommand command = (ICommand)control.GetValue(AttachedPropertyHelper.MouseDoubleClickProperty);
if (command.CanExecute(control.GetValue(AttachedPropertyHelper.IsLeafProperty)))
{
command.Execute(control);
}
}