Xamarin.UITest: Retrieving elements hidden from screen - xamarin

I want to write a UI test for my Xamarin.iOS app to make sure that all tableview elements/cells exist on a screen. I could use app.Query(e => e.All()), but this will only retrieve elements that are currently visible on the screen. Is there a way to retrieve all elements (including the ones hidden from the view) in order to assert that the retrieved elements are as expected, without initiating a scroll action?
Any suggestions are greatly appreciated.

There isn't a way to do it directly, but there are methods to scroll list views down to get more items, but the original ones will then be removed from the visual tree.
Table views use cell recycling, so they only creates enough cells to fill the screen. As you scroll cells that are scrolled off the top are 'recycled' and shown on the bottom with new data. This means that the cells of screen actually don't exist - so there is nothing that UI test can access.
I've done it in the past by getting the items and caching some values, scrolling, getting more items, scrolling etc, building up a list of items as I go. Then once there is no more to scroll, checking the values.

Related

How to share selection rectangle between multiple NSCollectionViews?

I am building an app, which will draw a representation of column-based data. I need both interactable cells and headers, so instead of adding suppplementary views for each column, I made another NSCollectionView that contains headers only.
The issue is that I would like to share selection rectangle state between these collection views, but I am not sure if there's some good way to achieve that or I have to hack whole controller.
Initially I was thinking about making an overlay on whole window, that would register in first responder chain, but it would use methods like draggedMouse only in my own methods and I would override built-in to pass the events to views behind, then if the view detected that user would like to draw a selection rectangle (select multiple items), that event would be moved to overlay view.
I thought also about making first row of items as sections (I am using compositional collection view layout, so it isn't that hard), but I think it would make features like drag and drop a huge pain in the bottom.
On the image you can see part of these collection views and how it looks now.

How to implement a selection control like Outlook with Xamarin

I am creating an event screen like Outlook's. The issue I am coming across is that the autocompletebox I am using from Syncfusion doesn't automatically grow in height as more tokens are added.
The current workflow is exactly like outlooks. When the control is clicked on, it brings you to another page where you can select tokens. On return, the selected items populate the autocomplete circled below.
The approach I currently took is to have a listview. Scrolling is disabled for the listview since the page resides in a scrollview and nested scrollviews aren't recommended for xamarin. The height of the listview is dependent on the number of selecteditems.
I am wondering if there's another approach or control that would be more suited for my situation? Or if someone has come across a autocomplete control where the height will grow.

Grid inside Table or MainTable

I have one WWSD or one SDPanel with some attributes but between these attributes that are fixed inside a Table or directly in the MainTable I want put and Grid, the problem is that the Grid is not showed and when I put the grid its no more possible scroll in the WWSD or SDPanel, is like the Grid stuck the SDPanel more than the grid is not showed.
Anyone can help me to put the Grid and keep with all normally ?
Thx.
I assume you're targeting Android.
The issue is that Android does not natively support nested scrolling. Therefore, a GeneXus layout that contains a grid will disable the form's own scrolling (so that the grid can itself scroll).
There are two ways of resolving this issue:
Redesign the panel so that the form does not vertically exceed the size of the screen (thus, form scrolling is not necessary).
Set autogrow=true for the grid, which will resize to fit all items (and "push down" any other controls located below it). Since the grid will no longer need to scroll, the form's scroll will be enabled.

Implementing a "fisheye" view with a ListBox

I am new to Windows Phone Programming. In my application, I Have a listbox which lists the phone contacts. Currently it is listed as a regular list with equal size for list items in the UI.I am looking to modify the front end like this :
I dont want to have different sizes /back ground color for each list items rather a fixed UI and let the lists scroll through it and the list item in the view, at any time, should be displayed as in the picture.
I dont expect any codes as answers but any examples are welcome too, just want to know using what feature this kind of functionality is possible so that i can do my reading!
Thanks,
Deepak
It would be difficult to modify an existing control (ListBox for example) to act like this, so your best bet would probably be an ItemsControl with its RenderTransform set as a TranslateTransform.
If you place a Rectangle (with Fill="Transparent") over the ItemsControl, you can attach handlers to the ManipulationStarted, ManipulationDelta, and ManipulationCompleted events to control the "scrolling" by setting the TranslateTransform's Y offset.
To resize the items in the list there are two options: a custom panel or manual setting.
Custom Panel
You could create a custom Panel implementation that will appropriately resize its Children based on a property you would create to represent the scroll position. Set the ItemsControl to use your panel, and either through binding or attaching a handler to the panel's Loaded event and keeping a pointer to the panel, update the aforementioned property from inside the ManipulationDelta handler.
Manual Setting
From inside of the ManipulationDelta handler, you can also calculate the various heights of the boxes and use MyItemsControl.ItemContainerGenerator.ContainerFromIndex to get the visual for each item and set its height.
I would suggest putting this all inside of a custom UserControl.
You may have issues with clipping using the TranslateTransform but hopefully this will get you started. Unfortunately, this looks like a rather difficult control to try making as your first windows phone project!
So Finally I did manage to find a way to do it.
First approach was as #Murkaeus suggested, Using UserControl and ManipulationDelta event handler. However for some reason the manipulationDelta event was triggered only for 2 finger gestures (Zoom, Pinch..etc), I have no clue why. And after some trying I had to give up on this.
The next approach was using Listbox itself. The source of the Listbox was set as the List( of Models objects) that I create after reading the contact information from phone. The height and color of the listbox item was bound to a property in my model named "scaleLevel" and was accordingly converted by implementing IValueConvertors to give predefined color and height values for different scale levels.
I created an attached property for the scrollviewer vertical offset like mentioned [here] (http://www.scottlogic.co.uk/blog/colin/2010/07/exposing-and-binding-to-a-silverlight-scrollviewer%E2%80%99s-scrollbars/)!
This event is triggered on change of the vertical offset and every time there is a scroll, I find out which listbox item to be enlarged and which reduced based current vertical offset.
Once I have this information, I change the property ("scaleLevel") of the affected items in the List (of Model) (which is bound to listbox height and color). This change is updated in UI using the INotifyPropertyChanged Event.
I have no idea if this the best way of doing it , but it works well and there is no considerable in updating the UI despite the processing involved.
I would like to hear your opinion about the implementation and any other solution which you feel will work better.

How to make a Widget slide view with Qt4?

I currently display several widgets (quite large ones, almost screen-wide) on a QStackedLayout, let's call these widgets "pages". Switching from a page to another is done with buttons below (previous, index, next).
I would like pages to slide while switching, as if they were placed on a larger-than-screen row, moving left or right depending on what the user wants.
For this I thought the QScrollArea would be OK, but I can add only one widget to it and I cannot index sub-items to move accordingly nor can I force a per-item-scroll (I don't want the sliding movement to stop between two pages.)
Another option is the QListView or other derivate from QAbstractItemView, but I can't find how to pass a widget as a QListItemModel or other reimplemented QAbstractItemModel. Roles for data are quite limited, and none seem to allow QWidgets.
How can I proceed to achieve this?
It seems using a QScrollArea and scroll programmatically using the inherited scrollContentsBy() would do the trick. The viewport then would be an elongated widget, sliding left or right so one section could be seen at a time.

Resources