Skip to content

Commit

Permalink
feat(Automation): Implement properties used by PagerControl
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jan 29, 2021
1 parent da80ce9 commit eed4842
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,23 @@ public partial class AutomationProperties
typeof(global::Windows.UI.Xaml.Automation.AutomationProperties),
new FrameworkPropertyMetadata(default(int)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty PositionInSetProperty { get; } =
Windows.UI.Xaml.DependencyProperty.RegisterAttached(
"PositionInSet", typeof(int),
typeof(global::Windows.UI.Xaml.Automation.AutomationProperties),
new FrameworkPropertyMetadata(default(int)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty SizeOfSetProperty { get; } =
Windows.UI.Xaml.DependencyProperty.RegisterAttached(
"SizeOfSet", typeof(int),
typeof(global::Windows.UI.Xaml.Automation.AutomationProperties),
new FrameworkPropertyMetadata(default(int)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.DependencyProperty LandmarkTypeProperty { get; } =
Windows.UI.Xaml.DependencyProperty.RegisterAttached(
Expand Down Expand Up @@ -301,14 +301,14 @@ public static void SetFullDescription( global::Windows.UI.Xaml.DependencyObject
}
#endif
// Forced skipping of method Windows.UI.Xaml.Automation.AutomationProperties.LandmarkTypeProperty.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.UI.Xaml.Automation.Peers.AutomationLandmarkType GetLandmarkType( global::Windows.UI.Xaml.DependencyObject element)
{
return (global::Windows.UI.Xaml.Automation.Peers.AutomationLandmarkType)element.GetValue(LandmarkTypeProperty);
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static void SetLandmarkType( global::Windows.UI.Xaml.DependencyObject element, global::Windows.UI.Xaml.Automation.Peers.AutomationLandmarkType value)
{
Expand All @@ -331,29 +331,29 @@ public static void SetLocalizedLandmarkType( global::Windows.UI.Xaml.DependencyO
}
#endif
// Forced skipping of method Windows.UI.Xaml.Automation.AutomationProperties.PositionInSetProperty.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static int GetPositionInSet( global::Windows.UI.Xaml.DependencyObject element)
{
return (int)element.GetValue(PositionInSetProperty);
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static void SetPositionInSet( global::Windows.UI.Xaml.DependencyObject element, int value)
{
element.SetValue(PositionInSetProperty, value);
}
#endif
// Forced skipping of method Windows.UI.Xaml.Automation.AutomationProperties.SizeOfSetProperty.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static int GetSizeOfSet( global::Windows.UI.Xaml.DependencyObject element)
{
return (int)element.GetValue(SizeOfSetProperty);
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static void SetSizeOfSet( global::Windows.UI.Xaml.DependencyObject element, int value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected override AutomationControlType GetAutomationControlTypeCore()
return AutomationControlType.Menu;
}

// TODO: Uno specific - workaround for #4259
protected override AutomationLandmarkType GetLandmarkTypeCore()
{
return AutomationLandmarkType.Navigation;
Expand Down
30 changes: 30 additions & 0 deletions src/Uno.UI/UI/Xaml/Automation/AutomationProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,36 @@ public static void SetAutomationId(DependencyObject element, string value)
=> element.SetValue(AutomationIdProperty, value);
#endregion

public static int GetPositionInSet(global::Windows.UI.Xaml.DependencyObject element) => (int)element.GetValue(PositionInSetProperty);

public static void SetPositionInSet(DependencyObject element, int value) => element.SetValue(PositionInSetProperty, value);

public static DependencyProperty PositionInSetProperty { get; } =
DependencyProperty.RegisterAttached(
"PositionInSet", typeof(int),
typeof(AutomationProperties),
new FrameworkPropertyMetadata(default(int)));

public static int GetSizeOfSet(DependencyObject element) => (int)element.GetValue(SizeOfSetProperty);

public static void SetSizeOfSet(DependencyObject element, int value) => element.SetValue(SizeOfSetProperty, value);

public static DependencyProperty SizeOfSetProperty { get; } =
DependencyProperty.RegisterAttached(
"SizeOfSet", typeof(int),
typeof(AutomationProperties),
new FrameworkPropertyMetadata(default(int)));

public static AutomationLandmarkType GetLandmarkType(DependencyObject element) => (AutomationLandmarkType)element.GetValue(LandmarkTypeProperty);

public static void SetLandmarkType(DependencyObject element, AutomationLandmarkType value) => element.SetValue(LandmarkTypeProperty, value);

public static DependencyProperty LandmarkTypeProperty { get; } =
DependencyProperty.RegisterAttached(
"LandmarkType", typeof(AutomationLandmarkType),
typeof(AutomationProperties),
new FrameworkPropertyMetadata(default(AutomationLandmarkType)));

#if __WASM__
private static string FindHtmlRole(UIElement uIElement) =>
uIElement switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,7 @@ protected override void SetFocusCore()
control.Focus(FocusState.Programmatic);
};
}

protected override AutomationLandmarkType GetLandmarkTypeCore() => AutomationProperties.GetLandmarkType(Owner);
}
}

0 comments on commit eed4842

Please sign in to comment.