[bcl] Updates referencesource to 4.7.1
[mono-project.git] / mcs / class / referencesource / System.Activities.Core.Presentation / System / Activities / Core / Presentation / ParallelSeparator.xaml.cs
blob1d68208d36be046da863251889ad53d629b2ffa1
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Core.Presentation
7 using System.Activities.Presentation;
8 using System.Activities.Presentation.Hosting;
9 using System.Windows;
10 using System.Windows.Automation;
11 using System.Windows.Media.Animation;
13 partial class ParallelSeparator
15 public static readonly DependencyProperty AllowedItemTypeProperty =
16 DependencyProperty.Register("AllowedItemType", typeof(Type), typeof(ParallelSeparator), new UIPropertyMetadata(typeof(object)));
18 public static readonly DependencyProperty ContextProperty = DependencyProperty.Register(
19 "Context",
20 typeof(EditingContext),
21 typeof(ParallelSeparator));
23 public ParallelSeparator()
25 this.InitializeComponent();
26 if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
28 SetValue(AutomationProperties.NameProperty, SR.ParallelSeparatorAutomationName);
32 public Type AllowedItemType
34 get { return (Type)GetValue(AllowedItemTypeProperty); }
35 set { SetValue(AllowedItemTypeProperty, value); }
38 public EditingContext Context
40 get { return (EditingContext)GetValue(ContextProperty); }
41 set { SetValue(ContextProperty, value); }
44 protected override void OnDragEnter(DragEventArgs e)
46 CheckAnimate(e, "Expand");
47 this.dropTarget.Visibility = Visibility.Visible;
50 protected override void OnDragLeave(DragEventArgs e)
52 CheckAnimate(e, "Collapse");
53 this.dropTarget.Visibility = Visibility.Collapsed;
56 protected override void OnDrop(DragEventArgs e)
58 this.dropTarget.Visibility = Visibility.Collapsed;
59 base.OnDrop(e);
62 void CheckAnimate(DragEventArgs e, string storyboardResourceName)
64 if (!e.Handled)
66 if (!this.Context.Items.GetValue<ReadOnlyState>().IsReadOnly &&
67 DragDropHelper.AllowDrop(e.Data, this.Context, this.AllowedItemType))
69 BeginStoryboard((Storyboard)this.Resources[storyboardResourceName]);
70 return;
72 else
74 e.Effects = DragDropEffects.None;
76 e.Handled = true;