diff options
author | Dominique Louis <dolouis@microsoft.com> | 2019-11-08 01:08:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-08 01:08:09 +0300 |
commit | 217cd27f4b95371a9edc6b4c2bb41f9b616a7eb4 (patch) | |
tree | c2c40138117eb9e2e6c304e8f9bf0239926ad670 | |
parent | 5f15e058e678ec1ce6ebed23cdb5b4e40ddaaa29 (diff) | |
parent | 70e8074aa62c2030cd60c68f963beb62abc2a5be (diff) |
Merge pull request #681 from xamarin/masterd16-4
Backport fixes for 999307 and 966531
4 files changed, 29 insertions, 8 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs b/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs index c22e438..2fee93f 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/EditorContainer.cs @@ -55,14 +55,6 @@ namespace Xamarin.PropertyEditing.Mac } } - public override void ViewWillMoveToSuperview (NSView newSuperview) - { - if (newSuperview == null) - ViewModel = null; - - base.ViewWillMoveToSuperview (newSuperview); - } - #if DEBUG // Currently only used to highlight which controls haven't been implemented public NSColor LabelTextColor { set { LabelControl.TextColor = value; } diff --git a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs index 49f2665..a322768 100644 --- a/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs +++ b/Xamarin.PropertyEditing.Mac/PropertyTableDelegate.cs @@ -184,6 +184,13 @@ namespace Xamarin.PropertyEditing.Mac } } + public override void DidRemoveRowView (NSOutlineView outlineView, NSTableRowView rowView, nint row) + { + if (rowView.Subviews[0] is EditorContainer ec) { + ec.ViewModel = null; + } + } + public override nfloat GetRowHeight (NSOutlineView outlineView, NSObject item) { EditorViewModel vm; diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs index b236d99..991ef5b 100644 --- a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs +++ b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs @@ -37,6 +37,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls }); AddProperty<FlagsNoValues> ("FlagsNoValues", ReadWrite, canWrite: true, flag: true); AddProperty<FlagsWithValues> ("FlagsWithValues", ReadWrite, canWrite: true, flag: true); + AddProperty<FlagsWithValues> ("prefix:FlagsWithColonInLabel", ReadWrite, canWrite: true, flag: true); AddProperty<CommonPoint> ("Point", ReadWrite, isUncommon: true); AddProperty<CommonSize> ("Size", ReadWrite, isUncommon: true); AddProperty<CommonRectangle> ("Rectangle", ReadWrite); diff --git a/Xamarin.PropertyEditing.Windows/CombinablePredefinedValuesEditorControl.cs b/Xamarin.PropertyEditing.Windows/CombinablePredefinedValuesEditorControl.cs index f259bd9..8e61a68 100644 --- a/Xamarin.PropertyEditing.Windows/CombinablePredefinedValuesEditorControl.cs +++ b/Xamarin.PropertyEditing.Windows/CombinablePredefinedValuesEditorControl.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Automation; +using Xamarin.PropertyEditing.ViewModels; namespace Xamarin.PropertyEditing.Windows { @@ -15,5 +17,24 @@ namespace Xamarin.PropertyEditing.Windows DefaultStyleKeyProperty.OverrideMetadata (typeof (CombinablePredefinedValuesEditor), new FrameworkPropertyMetadata (typeof (CombinablePredefinedValuesEditor))); FocusableProperty.OverrideMetadata (typeof(CombinablePredefinedValuesEditor), new FrameworkPropertyMetadata (false)); } + + public override void OnApplyTemplate () + { + base.OnApplyTemplate (); + + // Windows has the surprising behavior that when an automation group (like a group of combinable checkboxes) + // has a colon in the name, the group label is not read by the narrator. This causes a problem for the Android + // designer, which has property names like "app:layout_anchorGravity". We work around this by replacing the + // colon with a space in the group's automation name. + var propertyPresenter = this.FindParent<PropertyPresenter> (); + if (propertyPresenter != null) { + var name = (propertyPresenter.DataContext as PropertyViewModel)?.Name; + + if (name != null && name.Contains (":", StringComparison.Ordinal)) { + var automationName = name.Replace (':', ' '); + AutomationProperties.SetName (propertyPresenter, automationName); + } + } + } } } |