/// <summary> /// 初始化菜单; /// </summary> private void InitializeMenu() { _ribbon.AppMenu.Items.Clear(); //初始化顶级菜单; foreach (var menuItem in _mefMenuItems.OrderBy(p => p.Metadata.Order)) { var header = LanguageService.FindResourceString(menuItem.Metadata.HeaderLanguageKey); var radMenuItem = new RadMenuItem { Command = menuItem.Value.Command, Header = header }; if (!string.IsNullOrEmpty(menuItem.Metadata.Icon)) { radMenuItem.Icon = new Image { Source = new BitmapImage(new Uri(menuItem.Metadata.Icon, UriKind.RelativeOrAbsolute)), Width = Constants.MenuIconWidth, Height = Constants.MenuIconHeight }; } _ribbon.AppMenu.Items.Add(radMenuItem); ///设定UI自动化测试相关属性; AutomationProperties.SetAutomationId(radMenuItem, menuItem.Metadata.GUID); AutomationProperties.SetName(radMenuItem, header); if (menuItem.Metadata.Key != Key.None) { ShellService.Current.AddKeyBinding(menuItem.Value.Command, menuItem.Metadata.Key, menuItem.Metadata.ModifierKeys); } } }
public TestPlayerWindow() { this.InitializeComponent(); var dps = typeof(MediaElementWrapper).GetFields(BindingFlags.Static | BindingFlags.Public) .Where(f => f.FieldType == typeof(DependencyProperty)) .Select(f => f.GetValue(null)) .OfType <DependencyProperty>() .OrderBy(x => x.Name) .ToArray(); int row = 0; foreach (var dp in dps) { this.PropertyGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var label = new TextBox { Text = dp.Name, IsReadOnly = true, IsReadOnlyCaretVisible = true }; Grid.SetRow(label, row); Grid.SetColumn(label, 0); this.PropertyGrid.Children.Add(label); var value = new TextBox(); Grid.SetRow(value, row); Grid.SetColumn(value, 1); AutomationProperties.SetAutomationId(value, dp.Name); if (dp.ReadOnly) { var binding = new Binding { Path = new PropertyPath(dp.Name), ElementName = nameof(this.MediaElement), Mode = BindingMode.OneWay, Converter = NullConverter.Default }; BindingOperations.SetBinding(value, TextBox.TextProperty, binding); value.IsEnabled = false; } else { var binding = new Binding { Path = new PropertyPath(dp.Name), ElementName = nameof(this.MediaElement), Mode = BindingMode.TwoWay, Converter = NullConverter.Default }; BindingOperations.SetBinding(value, TextBox.TextProperty, binding); value.IsEnabled = true; } this.PropertyGrid.Children.Add(value); row++; } this.PropertyGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); }
private static void _WaitForBindingAndSet(DependencyProperty dp, DependencyObject d) { var frameworkElement = d as FrameworkElement; EventHandler handler = (sender, args) => { if (!string.IsNullOrWhiteSpace(GetAutomationIdOverride(d))) { return; } var binding = BindingOperations.GetBinding(d, dp); if (binding == null) { d.ClearValue(AutomationProperties.AutomationIdProperty); return; } if (!string.IsNullOrWhiteSpace(AutomationProperties.GetAutomationId(d))) { return; } AutomationProperties.SetAutomationId(d, binding.Path.Path); }; DependencyPropertyDescriptor.FromProperty(dp, d.GetType()).AddValueChanged(d, handler); if (frameworkElement != null) { frameworkElement.Unloaded += (sender, args) => DependencyPropertyDescriptor.FromProperty(dp, d.GetType()).RemoveValueChanged(d, handler); } }
private void InitializeDropDownButton(RadRibbonDropDownButton dropDownButton) { var ribbonGroupContext = dropDownButton.DataContext as CreatedRibbonGroup; var ribbonItems = GetAllRibbonItems(); var contextMenu = new RadContextMenu(); foreach (var ribbonItem in ribbonItems. Where(p => p.RibbonItemMetaData.GroupGUID == ribbonGroupContext.RibbonGroupMetaData.GUID)) { if (ribbonItem.RibbonItem is IRibbonButtonItem buttonItem) { var bitMapImage = !string.IsNullOrEmpty(buttonItem.Icon) ? new BitmapImage(new Uri(buttonItem.Icon, UriKind.RelativeOrAbsolute)) : null; var image = bitMapImage != null ? new Image { Source = bitMapImage }:null; var header = LanguageService.FindResourceString(buttonItem.HeaderLanguageKey); var menuItem = new RadMenuItem { Header = header, Icon = image, Command = buttonItem.Command }; ///设定UI自动化测试相关属性; AutomationProperties.SetAutomationId(menuItem, ribbonItem.RibbonItemMetaData.GUID); AutomationProperties.SetName(menuItem, header); contextMenu.Items.Add(menuItem); } } dropDownButton.DropDownContent = contextMenu; }
private void SetAutomationIdForNodes(TreeView tree) { var listControl = FindVisualChildByName(this.TestTreeView, "ListControl") as TreeViewList; Stack <TreeViewNode> pendingNodes = new Stack <TreeViewNode>(); foreach (var node in tree.RootNodes) { pendingNodes.Push(node); } while (pendingNodes.Count > 0) { var currentNode = pendingNodes.Pop(); foreach (var child in currentNode.Children) { pendingNodes.Push(child); } var container = tree.ContainerFromNode(currentNode); if (container != null) { AutomationProperties.SetAutomationId(container as DependencyObject, GetNodeContent(currentNode)); (container as FrameworkElement).SetValue(FrameworkElement.NameProperty, GetNodeContent(currentNode)); } } }
private static void ElementLoaded(object sender, RoutedEventArgs e) { var owner = (DependencyObject)sender; var hierarchy = owner.Traverse(VisualTreeHelper.GetParent); IList <string> routeSegments = new List <string>(); foreach (var element in hierarchy) { var id = GetId(element); var rootId = GetRootId(element); if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(rootId)) { continue; } routeSegments.Add(Translate(element, rootId ?? id)); if (!string.IsNullOrEmpty(rootId)) { break; } } if (!routeSegments.Any()) { return; } AutomationProperties.SetAutomationId(owner, string.Join("_", routeSegments.Reverse())); }
private ImageDiffWindow(Bitmap expected, Bitmap actual) { AutomationProperties.SetAutomationId(this, "Gu.Wpf.UiAutomationOverlayWindow"); AutomationProperties.SetName(this, "Gu.Wpf.UiAutomationOverlayWindow"); this.WindowStyle = WindowStyle.SingleBorderWindow; this.Topmost = true; this.ShowActivated = false; this.ShowInTaskbar = false; this.Height = 400; this.Width = 400; var root = new Grid(); root.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); root.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); this.expectedImage = this.CreateImage(expected); root.Children.Add(this.expectedImage); this.actualImage = this.CreateImage(actual); root.Children.Add(this.actualImage); var visibilityButton = new RepeatButton { Content = "Toggle visibility" }; visibilityButton.Click += this.OnVisibilityButtonClick; Grid.SetRow(visibilityButton, 1); root.Children.Add(visibilityButton); this.Content = root; }
public MainPage() { this.InitializeComponent(); AutomationProperties.SetName(this, "MainPage"); Loaded += OnLoaded; foreach (var locale in locales) { var item = new ComboBoxItem { Content = locale }; LanguageChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, locale); } // This setting is persisted across multiple openings of an app, so we always want to initialize it to en-US // in case the app crashed while in a different language or otherwise was not able to set it back. MUXControlsTestApp.App.LanguageOverride = "en-US"; // We'll additionally make sure that the combo box begins on the right element to reflect the current value. LanguageChooser.SelectedIndex = locales.IndexOf("en-US"); LongAnimationsDisabled.IsChecked = MUXControlsTestApp.App.DisableLongAnimations; // App remembers ExtendViewIntoTitleBar and the value persists true if test case aborted and didn't change it back // Always set it to false when app restarted CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.ExtendViewIntoTitleBar = false; }
public MainPage() { InitializeComponent(); AutomationProperties.SetName(this, "MainPage"); Loaded += OnLoaded; foreach (var locale in locales) { var item = new ComboBoxItem { Content = locale }; LanguageChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, locale); } foreach (var flowDirection in FlowDirections) { var item = new ComboBoxItem { Content = flowDirection.ToString(), Tag = flowDirection }; FlowDirectionChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, flowDirection.ToString()); } // This setting is persisted across multiple openings of an app, so we always want to initialize it to en-US // in case the app crashed while in a different language or otherwise was not able to set it back. App.LanguageOverride = "en-US"; // We'll additionally make sure that the combo box begins on the right element to reflect the current value. LanguageChooser.SelectedIndex = locales.IndexOf("en-US"); FlowDirectionChooser.SelectedIndex = FlowDirections.IndexOf(GetRootFlowDirection()); DataContext = this; }
private OverlayRectangleWindow(Rect rectangle, Color color, TimeSpan duration) { AutomationProperties.SetAutomationId(this, "Gu.Wpf.UiAutomationOverlayWindow"); AutomationProperties.SetName(this, "Gu.Wpf.UiAutomationOverlayWindow"); this.AllowsTransparency = true; this.WindowStyle = WindowStyle.None; this.Topmost = true; this.ShowActivated = false; this.ShowInTaskbar = false; this.Background = Brushes.Transparent; this.Top = rectangle.Top; this.Left = rectangle.Left; this.Width = rectangle.Width; this.Height = rectangle.Height; var borderBrush = new SolidColorBrush(color); borderBrush.Freeze(); this.Content = new Border { BorderThickness = new Thickness(2), BorderBrush = borderBrush }; var timer = new DispatcherTimer { Interval = duration }; timer.Tick += this.TimerTick; timer.Start(); }
private void CreateLayoutCellButton(int i, int cellLayoutCount) { Button btnCellLayout = new Button(); btnCellLayout.Name = "cellLayoutButton" + (i + 1); AutomationProperties.SetAutomationId(btnCellLayout, "ID_BTN_FILMING_CELLLAYOUT" + (i + 1)); btnCellLayout.Width = 35; btnCellLayout.Height = 35; btnCellLayout.Click += new RoutedEventHandler(btnCellLayout_Click); var style = "Style_Button_Common_CSW_Center"; if (i == 0) { style = "Style_Button_Common_CSW_Left"; } if (i == cellLayoutCount - 1) { style = "Style_Button_Common_CSW_Right"; } btnCellLayout.Style = Card.FindResource(style) as Style; btnCellLayout.FontSize = 12; btnCellLayout.Focusable = false; //Binding b1 = new Binding("IsEnabled") { Source = ViewModel.IsEnablePresetCellLayoutButton }; //btnCellLayout.SetBinding(Button.IsEnabledProperty, b1); var cellLayout = Printers.Instance.PresetCellLayouts[i]; int row = cellLayout.Row; int col = cellLayout.Col; btnCellLayout.Tag = i + 1; SetLayoutCellButtonAttribute(btnCellLayout, i + 1, row, col); layoutCellPanel.Children.Add(btnCellLayout); _cellLayouts.Add(new FilmLayout(row, col)); }
ActivatableTabItem CreateTabItem(IViewCreationCommand viewCreator, IServiceProvider serviceProvider) { View view = viewCreator.CreateView(serviceProvider); view.Title = viewCreator.DisplayName; var item = new ActivatableTabItem() { ViewCreator = viewCreator, View = view }; ActivatableTabItem.SetTabItem(view, item); view.Site = item; item.SetBinding(ActivatableTabItem.ContentProperty, new Binding { Source = view, Path = new PropertyPath("ViewContent") }); item.SetBinding(ActivatableTabItem.HeaderProperty, new Binding { Source = view, Path = new PropertyPath("Title") }); AutomationProperties.SetAutomationId(item, viewCreator.RegisteredName); view.Closed += OnViewClosed; return(item); }
private void AddNavigationItems(MUXC.NavigationView nv) { var categories = Assembly.GetExecutingAssembly().DefinedTypes .Where(x => x.Namespace?.StartsWith("Uno.Themes.Samples") == true) .Select(x => new { TypeInfo = x, SamplePageAttribute = x.GetCustomAttribute <SamplePageAttribute>() }) .Where(x => x.SamplePageAttribute != null) .Select(x => new Sample(x.SamplePageAttribute, x.TypeInfo.AsType())) .OrderByDescending(x => x.SortOrder.HasValue) .ThenBy(x => x.SortOrder) .ThenBy(x => x.Title) .GroupBy(x => x.Category); foreach (var category in categories.OrderBy(x => x.Key)) { var tier = 1; var parentItem = default(MUXC.NavigationViewItem); if (category.Key != SampleCategory.None) { parentItem = new MUXC.NavigationViewItem { Content = category.Key.GetDescription() ?? category.Key.ToString(), SelectsOnInvoked = false, Style = (Style)Resources[$"T{tier++}NavigationViewItemStyle"] }.Apply(NavViewItemVisualStateFix); AutomationProperties.SetAutomationId(parentItem, "Section_" + parentItem.Content); nv.MenuItems.Add(parentItem); } foreach (var sample in category) { var item = new MUXC.NavigationViewItem { Content = sample.Title, DataContext = sample, Style = (Style)Resources[$"T{tier}NavigationViewItemStyle"] }.Apply(NavViewItemVisualStateFix); AutomationProperties.SetAutomationId(item, "Section_" + item.Content); (parentItem?.MenuItems ?? nv.MenuItems).Add(item); } } void NavViewItemVisualStateFix(MUXC.NavigationViewItem nvi) { // gallery#107: on uwp and uno, deselecting a NVI by selecting another NVI will leave the former in the "Selected" state // to workaround this, we force reset the visual state when IsSelected becomes false nvi.RegisterPropertyChangedCallback(MUXC.NavigationViewItemBase.IsSelectedProperty, (s, e) => { if (!nvi.IsSelected) { // depending on the DisplayMode, a NVIP may or may not be used. var nvip = VisualTreeHelperEx.GetFirstDescendant <MUXCP.NavigationViewItemPresenter>(nvi, x => x.Name == "NavigationViewItemPresenter"); VisualStateManager.GoToState((Control)nvip ?? nvi, "Normal", true); } }); } }
/// <summary> /// Initializes a new instance of this control. /// </summary> public InnerList() : base() { // This flag is needed to dramatically increase performance of scrolling \\ VirtualizingStackPanel.SetVirtualizationMode(this, VirtualizationMode.Recycling); AutomationProperties.SetAutomationId(this, "InnerList"); // No localization needed }
public RatingControlPage() { this.InitializeComponent(); TestRatingControl.ValueChanged += TestRatingControl_ValueChanged; RatingDarkTheme.PlaceholderValue = 1.5; MyRatingReadOnlyTextBlock.Text = "2.2"; MyRatingReadOnlyWithPlaceholder.PlaceholderValue = 3.3; DisabledWithValue.Value = 3; DisabledWithPlaceholderValue.PlaceholderValue = 3; CustomImages.Value = 3.0; CustomImages.PlaceholderValue = 1.5; var imageInfo = new RatingItemImageInfo(); imageInfo.Image = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_set.png")); imageInfo.UnsetImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_unset.png"));; imageInfo.PlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_placeholder.png"));; imageInfo.DisabledImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_disabled.png"));; imageInfo.PointerOverImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverset.png"));; imageInfo.PointerOverPlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverplaceholder.png")); CustomImagesTwo.ItemInfo = imageInfo; CustomImagesTwo.Value = 3.0; CustomImagesTwo.PlaceholderValue = 4.25; PointerOverPlaceholderFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderFallbackRating_PointerMoved), true); PointerOverFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverFallbackRating_PointerMoved), true); PointerOverPlaceholderImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderImageFallbackRating_PointerMoved), true); PointerOverImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverImageFallbackRating_PointerMoved), true); ColorFlipButton.Foreground = _tomato; RatingBindingSample.DataContext = CaptionStringBox; BindingRatingCaption.DataContext = ColorFlipButton; //TODO: Uno Platform - WinUI wraps controls in a "TestFrame" which has some "ambient" features, including the view scaling checkbox //var testFrame = Window.Current.Content as TestFrame; //DependencyObject checkBox = SearchVisualTree(testFrame, "ViewScalingCheckBox"); //CheckBox cb = checkBox as CheckBox; //FrameDetails.Text = Window.Current.Bounds.ToString() + " " + cb.IsChecked.ToString(); #if !HAS_UNO if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl")) { var wuxcRatingControl = new Windows.UI.Xaml.Controls.RatingControl(); wuxcRatingControl.Name = "WUXC RatingControl"; wuxcRatingControl.Caption = "WUXC RatingControl"; AutomationProperties.SetAutomationId(wuxcRatingControl, "wuxcRatingControl"); this.mainStackPanel.Children.Add(wuxcRatingControl); } #endif }
private void Button_Click(object sender, RoutedEventArgs e) { AutomationProperties.SetAutomationId(Tname, "ID_NAME"); AutomationProperties.SetAutomationId(Tage, "ID_AGE"); AutomationProperties.SetAutomationId(Temail, "ID_EMAIL"); //string path = @"C:\Users\adams\source\repos\WpfUiaPractice\UiaImplementer\bin\Debug\UiaImplementer.dll"; // Process.Start(path); Main(null); }
private void InitializeRibbonGroup(RadRibbonGroup ribbonGroupControl) { var ribbonGroup = ribbonGroupControl.DataContext as CreatedRibbonGroup; var allRibbonGroups = GetAllRibbonGroups(); var allRibbonItems = GetAllRibbonItems(); foreach (var innerRibbonGroup in allRibbonGroups. Where(p => p.RibbonGroupMetaData.ParentGUID == ribbonGroup.RibbonGroupMetaData.GUID)) { var icon = innerRibbonGroup.RibbonGroupMetaData.Icon; var text = LanguageService.FindResourceString(innerRibbonGroup.RibbonGroupMetaData.HeaderLanguageKey); var dropDownButton = new RadRibbonDropDownButton { DataContext = innerRibbonGroup, SmallImage = !string.IsNullOrEmpty(icon) ? new BitmapImage(new Uri(icon)):null, Size = ButtonSize.Large, Text = text }; ///设定UI自动化测试相关属性; AutomationProperties.SetAutomationId(dropDownButton, innerRibbonGroup.RibbonGroupMetaData.GUID); AutomationProperties.SetName(dropDownButton, text); InitializeDropDownButton(dropDownButton); ribbonGroupControl.Items.Add(dropDownButton); } foreach (var ribbonItem in allRibbonItems. Where(p => p.RibbonItemMetaData.GroupGUID == ribbonGroup.RibbonGroupMetaData.GUID)) { if (ribbonItem.RibbonItem is IRibbonButtonItem buttonItem) { var bitmapImage = !string.IsNullOrEmpty(buttonItem.Icon) ? new BitmapImage(new Uri(buttonItem.Icon, UriKind.RelativeOrAbsolute)) : null; var text = LanguageService.FindResourceString(buttonItem.HeaderLanguageKey); var ribbonButton = new RadRibbonButton { Command = buttonItem.Command, Text = text, LargeImage = bitmapImage, SmallImage = bitmapImage, Size = ButtonSize.Large }; ///设定UI自动化测试相关属性; AutomationProperties.SetAutomationId(ribbonButton, ribbonItem.RibbonItemMetaData.GUID ?? string.Empty); AutomationProperties.SetName(ribbonButton, text ?? string.Empty); ribbonGroupControl.Items.Add(ribbonButton); } else if (ribbonItem.RibbonItem is IRibbonObjectItem objectItem) { ribbonGroupControl.Items.Add(objectItem.UIObject); } } }
private void FindAndGiveAutomationIdToVisualChild(string childName) { DependencyObject obj = FindVisualChildByName(this.ColorPicker, childName); if (obj != null) { AutomationProperties.SetAutomationId(obj, childName); } }
private static void OnTextBoxIdChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = d as TextBox; if (textBox != null) { AutomationProperties.SetAutomationId(textBox, (string)e.NewValue); } }
private void CustomImagesTwo_Loaded(object sender, RoutedEventArgs e) { DependencyObject obj = FindVisualChildByName(CustomImagesTwo, "RatingBackgroundStackPanel"); var child = VisualTreeHelper.GetChild(obj, 0); AutomationProperties.SetAutomationId(child, "CustomImagesTwo_FirstImageItem"); AutomationProperties.SetAccessibilityView(child, Windows.UI.Xaml.Automation.Peers.AccessibilityView.Control); CustomImagesTwoLoadedStageOneCheckBox.IsChecked = true; }
private void AddButtonSuppressSelection_Click(object sender, RoutedEventArgs e) { var newItem = new NavigationViewItem() { Content = "New Menu Item S.S", SelectsOnInvoked = false }; AutomationProperties.SetAutomationId(newItem, "sup-selection-nav-item-" + suppressSelectionNextNumber); m_menuItems.Add(newItem); suppressSelectionNextNumber++; }
/// <summary> /// Set loaded as true when this method invoked. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">RoutedEvent Args.</param> private void GridViewWindowLoaded(object sender, RoutedEventArgs e) { // signal the main thread this.gridViewWindowLoaded.Set(); // Make gridview window as active window this.gridViewWindow.Activate(); // Set up AutomationId and Name AutomationProperties.SetName(this.gridViewWindow, GraphicalHostResources.OutGridViewWindowObjectName); AutomationProperties.SetAutomationId(this.gridViewWindow, "OutGridViewWindow"); }
/// <summary> /// Set up context menu item for Column Picker feature. /// </summary> /// <returns>True if it is successfully set up.</returns> private bool SetColumnPickerContextMenuItem() { MenuItem columnPicker = new MenuItem(); AutomationProperties.SetAutomationId(columnPicker, "ChooseColumns"); columnPicker.Header = UICultureResources.ColumnPicker; columnPicker.Click += new RoutedEventHandler(this.innerGrid.OnColumnPicker); this.contextMenu.Items.Add(columnPicker); return(true); }
public RatingControlPage() { this.InitializeComponent(); TestRatingControl.ValueChanged += TestRatingControl_ValueChanged; RatingDarkTheme.PlaceholderValue = 1.5; MyRatingReadOnlyTextBlock.Text = "2.2"; MyRatingReadOnlyWithPlaceholder.PlaceholderValue = 3.3; DisabledWithValue.Value = 3; DisabledWithPlaceholderValue.PlaceholderValue = 3; CustomImages.Value = 3.0; CustomImages.PlaceholderValue = 1.5; var imageInfo = new RatingItemImageInfo(); imageInfo.Image = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_set.png")); imageInfo.UnsetImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_unset.png"));; imageInfo.PlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_placeholder.png"));; imageInfo.DisabledImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_disabled.png"));; imageInfo.PointerOverImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverset.png"));; imageInfo.PointerOverPlaceholderImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/Assets/rating_mouseoverplaceholder.png")); CustomImagesTwo.ItemInfo = imageInfo; CustomImagesTwo.Value = 3.0; CustomImagesTwo.PlaceholderValue = 4.25; PointerOverPlaceholderFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderFallbackRating_PointerMoved), true); PointerOverFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverFallbackRating_PointerMoved), true); PointerOverPlaceholderImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverPlaceholderImageFallbackRating_PointerMoved), true); PointerOverImageFallbackRating.AddHandler(RatingControl.PointerMovedEvent, new PointerEventHandler(PointerOverImageFallbackRating_PointerMoved), true); ColorFlipButton.Foreground = _tomato; RatingBindingSample.DataContext = CaptionStringBox; BindingRatingCaption.DataContext = ColorFlipButton; FrameDetails.Text = Window.Current.Bounds.ToString(); if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.RatingControl")) { var wuxcRatingControl = new Windows.UI.Xaml.Controls.RatingControl(); wuxcRatingControl.Name = "WUXC RatingControl"; wuxcRatingControl.Caption = "WUXC RatingControl"; AutomationProperties.SetAutomationId(wuxcRatingControl, "wuxcRatingControl"); this.mainStackPanel.Children.Add(wuxcRatingControl); } }
public CacheckWindow() { InitializeComponent(); var builder = new ContainerBuilder().UseCacheckVishizhukelNetAndPeghAsync(this).Result; Container = builder.Build(); Title = Properties.Resources.CacheckWindowTitle; Name = Properties.Resources.CacheckWindowName; AutomationProperties.SetAutomationId(this, Name); AutomationProperties.SetName(this, Name); }
public RevealFallbackPage() { this.InitializeComponent(); if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase")) { AutomationProperties.SetName(this, "RevealFallbackPage"); AutomationProperties.SetAutomationId(this, "RevealFallbackPage"); _revealTestApi = new RevealTestApi(); _revealBrushTestApi = new RevealBrushTestApi(); } }
public RevealRegressionTestsPage() { this.InitializeComponent(); if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase")) { AutomationProperties.SetName(this, "RevealRegressionTestsPage"); AutomationProperties.SetAutomationId(this, "RevealRegressionTestsPage"); MaterialHelperTestApi.IgnoreAreEffectsFast = true; MaterialHelperTestApi.SimulateDisabledByPolicy = false; } }
//private void InitDefaultViewportLayoutCollection() //{ // foreach (var layout in DefaultButtonCellLayout) // { // //FilmLayout layout = ViewportLayoutCollection.ElementAt(0); // //layout = new FilmLayout(1, 1, layout.LayoutName); // layout.LayoutType = LayoutTypeEnum.RegularLayout; // filmingCard.layoutCtrl.DefaultViewportLayoutCollection.Add(layout); // //layout = ViewportLayoutCollection.ElementAt(1); // //DefaultViewportLayoutCollection.Add(layout); // //layout = ViewportLayoutCollection.ElementAt(2); // //DefaultViewportLayoutCollection.Add(layout); // } //} private void AddMGViewLayoutBtn() { filmingCard.layoutCtrl.viewportLayoutPanel.Children.Clear(); try { var layoutList = filmingCard.IsModalityDBT() ? DefaultButtonCellLayoutForDBT : DefaultButtonCellLayout; int count = layoutList.Count; for (var i = 0; i < count; i++) { var layout = layoutList[i] as FilmLayout; var row = layout.LayoutRowsSize; var col = layout.LayoutColumnsSize; Button itemBtn = new Button(); var k = i + 1; itemBtn.Name = "viewportLayoutButton" + k; AutomationProperties.SetAutomationId(itemBtn, "ID_BTN_FILMING_VIEWPORTLAYOUT" + k); itemBtn.Click += new RoutedEventHandler(ItemBtn_Click); var btnStyle = "Style_Button_Common_CSW_Center"; if (i == 0) { btnStyle = "Style_Button_Common_CSW_Left"; } if (i == count - 1) { btnStyle = "Style_Button_Common_CSW_Right"; } var layoutName = col.ToString() + "x" + row.ToString(); itemBtn.Style = filmingCard.FindResource(btnStyle) as Style; itemBtn.HorizontalAlignment = HorizontalAlignment.Left; itemBtn.VerticalAlignment = VerticalAlignment.Top; var toopTip = layoutName + filmingCard.FindResource(string.Format("UID_Filming_ViewportLayout")); itemBtn.ToolTip = toopTip as string; itemBtn.Width = 35; itemBtn.Height = 35; itemBtn.TabIndex = k; Image img = new Image(); //if (layoutName == "1x2") layoutName = "2x1"; string imgPath = string.Format("layout{0}", layoutName); img.Source = filmingCard.FindResource(imgPath) as ImageSource; itemBtn.Content = img; filmingCard.layoutCtrl.viewportLayoutPanel.Children.Add(itemBtn); } }catch (Exception ex) { Logger.LogFuncException(ex.Message + ex.StackTrace); } }
public MainPage() { this.InitializeComponent(); AutomationProperties.SetName(this, "MainPage"); Loaded += OnLoaded; foreach (var locale in locales) { var item = new ComboBoxItem { Content = locale }; LanguageChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, locale); } foreach (var flowDirection in FlowDirections) { var item = new ComboBoxItem { Content = flowDirection.ToString(), Tag = flowDirection }; FlowDirectionChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, flowDirection.ToString()); } foreach (var adjustment in AppHighContrastAdjustments) { var item = new ComboBoxItem { Content = adjustment.Item2, Tag = adjustment.Item1 }; AppHighContrastAdjustmentChooser.Items.Add(item); AutomationProperties.SetAutomationId(item, (string)item.Content); } // This setting is persisted across multiple openings of an app, so we always want to initialize it to en-US // in case the app crashed while in a different language or otherwise was not able to set it back. MUXControlsTestApp.App.LanguageOverride = "en-US"; // We'll additionally make sure that the combo box begins on the right element to reflect the current value. LanguageChooser.SelectedIndex = locales.IndexOf("en-US"); LongAnimationsDisabled.IsChecked = MUXControlsTestApp.App.DisableLongAnimations; FlowDirectionChooser.SelectedIndex = FlowDirections.IndexOf(GetRootFlowDirection()); AppHighContrastAdjustmentChooser.SelectedIndex = AppHighContrastAdjustments.FindIndex(a => a.Item1 == ApplicationHighContrastAdjustment.None); // default to aware AxeTestCaseSelection.ItemsSource = TestInventory.AxeTests; // App remembers ExtendViewIntoTitleBar and the value persists true if test case aborted and didn't change it back // Always set it to false when app restarted CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.ExtendViewIntoTitleBar = false; }
private void WindowFocusTests_Button_OnClick(object sender, RoutedEventArgs e) { var window1 = new WindowFocusTestsWindow(); AutomationProperties.SetAutomationId(window1, "CUI_WindowFocusTestsWindow_1"); window1.Owner = this; window1.Show(); var window2 = new WindowFocusTestsWindow(); AutomationProperties.SetAutomationId(window2, "CUI_WindowFocusTestsWindow_2"); window2.Owner = this; window2.Show(); }