Xamarin Forms determine size text will consume - xamarin.forms

I believe I have seen this someplace before. I believe this is a way, based on knowing the text you are going to put in a control (say a label), that you can ask Xamarin Forms to tell you what the size of the control would be. If I recall correctly you used somaline like OnDevice and had to pass in the Text and the type of control. I just can't seem to find this now. Does anyone know if this is possible?
To be clear I am trying to address a defect in a third party control (SyncFusion DataGrid) I am using where the control is not sizing a grid column correctly. I was trying no to wait until the fix we released but I guess I will have to.

Syncfusion actually posted an updated that does finally seem to fix the problem of the columns not being sized correctly by width. I can't close this so I will just mark this as the answer.
For Syncfusion you can now do this:
mydatagrid.GridColumnSizer.Refresh();
mydatagrid.WidthRequest = mydatagrid.GetVisualContainer().ExtentWidth;

Related

How to detect colorisation on a text box with Squish and Robot framework?

I have a desktop application that has a form that people fill out in text boxes. If an invalid value is entered, then the box turns pink with a red border. I am using Robot framework with Squish to try and identify this error when it occurs on a certain textbox. What is the best way to do this?
Typically in QT, when actions happen they are firing signals and a slot in certain component. I'd assume that the state of the component is handled with something that triggers a signal that and the textbox receives it.
You could try to monitor what gets triggered when invalid input is given and use that in your asserts..
Another way, you might be able to read the property of your text input widget and see what changes when invalid input is given ..
Getting the internal state that results in alteration of the rendering may not be straightforward, but at least depends on which GUI technology is in use. (You have not told us yet, I think.)
A simpler approach is to use a screenshot verification point (SVP) for just that control. In that SVP, you can use a positive mask to mark a specific area that is least likely to be affected by the contents of the control (to make the SVP as robust as possible).
A similar approach is to use (verifying the actual pixel colors used for rendering on the screen) object.grabScreenshot() and use the API of the returned Image Object to query the color of an individual pixel via Image.getPixelRGB(x, y) and Image.getPixelRGBA(x, y).

Xamarin Forms ListView scrolled to top?

I have a InfiniteListView which extend ListView from Xamarin Forms.
I know when you on the last item in the list but how can i figure out if the user scrolled to the top of the list ?
Unfortunately, the Xamarin Forms ListView does not expose a Scrolled event or Position property. So your only option is to use the ItemAppearing and ItemDisappearing events.
When you subscribe to these events, you can figure out if the first cell is appearing again, after it disappeared first. This does not actually give you a 100% correct outcome, since it can happen that only a part of the first cell is shown.
If you want a perfect check that you are at the absolute top, you will have to resort to a custom renderer:
On iOS you can make use of the tableView.contentOffset.y property on the UITableView.
On Android it's a little bit more involved, as there are multiple (but no straightforward) ways to achieve this. See this answer for one possibility. This approach is originally meant for saving and restoring scroll position, so adjust it to your needs.
Other platforms have similar ideas. Check which native control the Xamarin Forms renderer creates, and then search the internet for possible solutions for that specific platform.

Creating a progress bar in vb.net

I have been searching for awhile for a tutorial or anything, but cant seem to find anything. What im looking to to is in my web application build a progress bar similar to that in the window.form controls. Any help or any kind of direction would be very helpful. Im not looking for someone do it for me, just a link or some pointers of how to get started
A progress bar is a control that holds 3 major attributes : (you should look at System.Windows.Forms.ProgressBar to have an idea of what ProgreeBar are made of)
a minimum
a maximum
a value
you have to re-render asynchronously and regularly to update status of the control to the user.
Basically the only big difference from WinForms ProgressBar and Net.UI. Progreebar are the graphical control used to render the progress . So you could use a size fixed graphical control (e.g a label) and from min to max add some content in it.
In most cases it is not the value changed that raise an event to be handled , but handling an event that update the value of your progress bar. Look at the example in this page : http://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.aspx
PS : It exists some (free or not) .NET ProgressBar like Neat Upload.
Have fun with it :P
In the design page(.aspx) you can use ScriptManager control and a UpdateProgress control that are under AJAX Extension category in the Visual Studio’s toolbox. You can use your own GIF file, as well.
You can check the below link:
http://www.webcodeexpert.com/2013/05/show-progress-image-using.html

ASP.Net - Possible to edit multi rows in grid, then save all? PLUS...partial postback of single row with new value retrieval from dataset

I need to implement a grid in asp.net that behaves almost exactly like MS Excel.
- can navigate around with arrow keys
- you can edit the cell that currently has focus by simply typing
- supports checkboxes, dropdownlists, etc
One crucial requirement is....I need to be able to somehow, after update of any cell within a row, pass that updated value back to the server, as there is a calculation process that happens using that updated value that can update other cells in the row, and I need to essentially rebind all the cells in the current row with the updated values resulting from the calculation. AND...when I do this, I want to retain focus on the cell that had it after the update of the former cell. Without grid scrolling, etc, etc.
If you're wondering what I'm talking about, just imagine Microsoft Excel, but I need to perform the formula calculations on the server and refresh all cells in the current row with the results....and, not lose focus of my current cell.
I am more than happy to pay $1000 or whatever it is for one of the full blown commercial ASP.Net grid controls, but from the ones I have tried so far, they seem to not be capable of this, at least I don't know how.
Aspose Grid - would have worked great, except it is totally full of bugs
Telerik RadGrid - a colleague familiar with that grid is trying to figure it out with no luck
Farpoint Grid - looks promising but haven't tried it out yet
If anyone has any advice on how to specifically accomplish this, it would be much appreciated.
Have you tried the extjs sample?
It has a commercial licence, but you can try it for free.
I managed to find an example about Excel-like RadGrid by Telerik - if you are interested in it, you can see it here. And good luck with your implementation.
Did you look into using jQuery for this? Look into jQuery templates and ajax.

Mercury Quick Test Pro - Testing with a custom grid

We are trying to create some tests that reference an vendors custom grid. Unfortunatly QTP only recognises it as a WinObject which is quite useless. We need to be able to navigate the grid and change cell values, double click on a cell(without using X,Y co-ordinates) etc.
Ideally we want to get QTP to understand that this object is a grid and treat it as one.
Any help would be greatly appreciated.
Thanks
Jon
What vendor?
I have a few suggestions:
Use key strokes to navigate the grid, rather than mouse clicks. Ctrl-Home to set focus to the top-left cell, then use up, down, left, right to move around. Use Enter keystroke to simulate double clicking. Often you can use Ctrl-A, Ctrl-C to copy the contents of the grid to the system clipboard, and use the clipboard API to retrieve the data.
You may be able to programmatically get/set the grid properties using the .Object property. .Object provides access to the underlying native properties and methods of the object, as opposed to the QTP methods and properties. You could do something like the following pseudo-code to set focus to a cell and change the value. Your code would differ depending on the vendor implementation. Consult the vendor's documentation to find out what methods and properties you would be able to use.
WinObject("mygrid").Object.CurRow = 1
WinObject("mygrid").Object.CurCol = 1
WinObject("mygrid").Object.Value = "my new value"
If the grid in question happens to be a Stingray Objective Grid, QTP has plugins specifically for that.
Same thing for Infragistics. They have a plug-in for QTP for the UltraWinGrid etc.
http://www.infragistics.com/dotnet/testadvantage.aspx#Overview
It is resonable to send the request to Support Center. If they will get a big number of requests - they will add support for your grid-vendor.
May be you forgot to load (install) AddIn for your grid-vendor.

Resources