Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -846,5 +846,16 @@ namespace System.Activities.Core.Presentation {
return ResourceManager.GetString("WrongNumberOfArgumentsForActivityDelegate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string for the automation name of ParallelSeparator
/// </summary>
internal static string ParallelSeparatorAutomationName
{
get
{
return ResourceManager.GetString("ParallelSeparatorAutomationName", resourceCulture);
}
}
}
}

View File

@ -7,6 +7,7 @@ namespace System.Activities.Core.Presentation
using System;
using System.Activities.Presentation;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
@ -25,7 +26,13 @@ namespace System.Activities.Core.Presentation
public static readonly DependencyProperty ValueTypeProperty =
DependencyProperty.Register("ValueType", typeof(Type), typeof(CaseKeyBox), new PropertyMetadata(OnValueTypeChanged));
public static readonly DependencyProperty EditorAutomationNameProperty =
DependencyProperty.Register("EditorAutomationName", typeof(string), typeof(CaseKeyBox));
public static readonly DependencyProperty ComboBoxAutomationNameProperty =
DependencyProperty.Register("ComboBoxAutomationName", typeof(string), typeof(CaseKeyBox));
public static RoutedEvent ValueCommittedEvent =
EventManager.RegisterRoutedEvent("ValueCommitted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(CaseKeyBox));
@ -174,6 +181,18 @@ namespace System.Activities.Core.Presentation
set { SetValue(ValueTypeProperty, value); }
}
public string ComboBoxAutomationName
{
get { return (string)GetValue(ComboBoxAutomationNameProperty); }
set { SetValue(ComboBoxAutomationNameProperty, value); }
}
public string EditorAutomationName
{
get { return (string)GetValue(EditorAutomationNameProperty); }
set { SetValue(EditorAutomationNameProperty, value); }
}
public void RegainFocus()
{
if (this.visibleBox != null)
@ -249,10 +268,39 @@ namespace System.Activities.Core.Presentation
{
UIElement box = (UIElement)sender;
ComboBox comboBox = box as ComboBox;
if (comboBox != null && comboBox.IsVisible)
if (comboBox != null)
{
ComboBoxHelper.SynchronizeComboBoxSelection(comboBox, this.ViewModel.Text);
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
if (!string.IsNullOrEmpty(ComboBoxAutomationName))
{
comboBox.SetValue(AutomationProperties.NameProperty, ComboBoxAutomationName);
}
if (comboBox.IsEditable && comboBox.Template != null)
{
var comboBoxTextBox = comboBox.Template.FindName("PART_EditableTextBox", comboBox) as TextBox;
if (comboBoxTextBox != null && !string.IsNullOrEmpty(EditorAutomationName))
{
comboBoxTextBox.SetValue(AutomationProperties.NameProperty, EditorAutomationName);
}
}
}
if (comboBox.IsVisible)
{
ComboBoxHelper.SynchronizeComboBoxSelection(comboBox, this.ViewModel.Text);
}
}
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
TextBox textBox = box as TextBox;
if (textBox != null && !string.IsNullOrEmpty(EditorAutomationName))
{
textBox.SetValue(AutomationProperties.NameProperty, EditorAutomationName);
}
}
if (box.IsVisible)
{
box.Focus();

View File

@ -7,6 +7,7 @@ namespace System.Activities.Core.Presentation
using System.Activities.Presentation;
using System.Activities.Presentation.Hosting;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Media.Animation;
partial class ParallelSeparator
@ -22,6 +23,10 @@ namespace System.Activities.Core.Presentation
public ParallelSeparator()
{
this.InitializeComponent();
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
SetValue(AutomationProperties.NameProperty, SR.ParallelSeparatorAutomationName);
}
}
public Type AllowedItemType

View File

@ -17,6 +17,8 @@ namespace System.Activities.Core.Presentation
using System.IO;
using System.Runtime;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Input;
using System.Windows.Threading;
using System.Windows.Controls;
@ -454,6 +456,18 @@ namespace System.Activities.Core.Presentation
}
}
void OnTryAddActivityKeyDown(object sender, KeyEventArgs e)
{
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
if (sender == e.OriginalSource && (e.Key == Key.Space || e.Key == Key.Enter))
{
ExpandTryView();
e.Handled = true;
}
}
}
void OnFinallyViewKeyDown(object sender, KeyEventArgs e)
{
if (sender == e.OriginalSource && (e.Key == Key.Space || e.Key == Key.Enter))
@ -463,6 +477,18 @@ namespace System.Activities.Core.Presentation
}
}
void OnFinallyAddActivityKeyDown(object sender, KeyEventArgs e)
{
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
if (sender == e.OriginalSource && (e.Key == Key.Space || e.Key == Key.Enter))
{
ExpandFinallyView();
e.Handled = true;
}
}
}
#region AddCatch Label & TypePresenter
void OnAddCatchMouseDown(object sender, MouseButtonEventArgs e)
@ -602,4 +628,29 @@ namespace System.Activities.Core.Presentation
return true;
}
}
internal class TextBlockWrapper : TextBlock
{
protected override AutomationPeer OnCreateAutomationPeer()
{
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
return new TextBlockWrapperAutomationPeer(this);
}
return base.OnCreateAutomationPeer();
}
}
internal class TextBlockWrapperAutomationPeer : TextBlockAutomationPeer
{
public TextBlockWrapperAutomationPeer(TextBlockWrapper owner)
: base(owner)
{
}
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Button;
}
}
}

View File

@ -14,6 +14,7 @@ namespace System.ServiceModel.Activities.Presentation
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
using System.Xml;
@ -100,6 +101,22 @@ namespace System.ServiceModel.Activities.Presentation
base.OnKeyDown(e);
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
if (!LocalAppContextSwitches.UseLegacyAccessibilityFeatures)
{
this.SetValue(AutomationProperties.NameProperty, this.Resources["MessageQueryEditorAutomationName"]);
if (this.IsEditable && this.Template != null)
{
var textBox = this.Template.FindName("PART_EditableTextBox", this) as TextBox;
if (textBox != null)
{
textBox.SetValue(AutomationProperties.NameProperty, this.GetValue(AutomationProperties.NameProperty));
}
}
}
}
//user double clicked on the expanded type, create a xpath
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "Propagating exceptions might lead to VS crash.")]