/// <summary> /// 获取默认的漂浮效果 /// </summary> /// <param name="element"></param> /// <returns></returns> private static FloatingEffect GetDefaultFloatingEffect(FrameworkElement element) { var floating = new FloatingEffect(element) { Is3DEnable = true, FloatingDuration = TimeSpan.FromMilliseconds(1000), IsActive = false, ThreeDFloatingRangle = 20 }; return(floating); }
protected override void OnAttached() { base.OnAttached(); _floatingEffect = new FloatingEffect(AssociatedObject); var b1 = new Binding("FloatingRange") { Source = this }; BindingOperations.SetBinding(_floatingEffect, FloatingEffect.FloatingRangeProperty, b1); var b2 = new Binding("FloatingDuration") { Source = this }; BindingOperations.SetBinding(_floatingEffect, FloatingEffect.FloatingDurationProperty, b2); var b3 = new Binding("IsActive") { Source = this }; BindingOperations.SetBinding(_floatingEffect, FloatingEffect.IsActiveProperty, b3); var b4 = new Binding("Is3DEnable") { Source = this }; BindingOperations.SetBinding(_floatingEffect, FloatingEffect.Is3DEnableProperty, b4); var b5 = new Binding("ThreeDFloatingRangle") { Source = this }; BindingOperations.SetBinding(_floatingEffect, FloatingEffect.ThreeDFloatingRangleProperty, b5); _floatingEffect.Floating(); }
/// <summary> /// 获取默认的漂浮效果 /// </summary> /// <param name="element"></param> /// <returns></returns> private static FloatingEffect GetDefaultFloatingEffect(FrameworkElement element) { var floating = new FloatingEffect(element) { Is3DEnable = true, FloatingDuration = TimeSpan.FromMilliseconds(1000), IsActive = false, ThreeDFloatingRangle = 20 }; return floating; }
protected override void OnDetaching() { base.OnDetaching(); IsActive = false; _floatingEffect = null; }