I love Xamarin Forms - it is a great developement tool for cross-platform mobile applications. One thing that new converts have always questioned, is the lack of a forms designer.
We haven't come up with a forms designer, but we have come up with a way of generating the XAML to create controls in your code.
We are hoping that this is helpful for existing Xamarin developers, but will also help those new to the platform easily generate controls, which they can then tune to their own requirements.
Released as an add-in to Visual Studio, Xamarin Controls will allow you to choose from a pre-set of properties for a control, and will generate the XAML and insert it into your XAML code.
You can see a video of the add-in in action here.
Currently we cater for adding the code for the following controls:-
- Date/Time Picker
- Radio Buttons
- Check Box
- Label and Entry
Simply right-click in your XAML code window to get a menu of controls.
Select the control you want to generate and a 'selection box' appears, allowing you to choose properties for your control. In this case we have chosen 'Label.
If you are using a 'style' for your label, you can enter it in the 'style' box, and if you have a binding context, again, enter it into the box, and it will replace the 'text' entry in the code.
The parameters persist between sessions, but if you right click on the 'group box' containing all the controls, you can go back to the default parameters.
If you select 'Control in Grid', 3 more fields appear, allowing you to select a row, column and column span, to place your control in a grid. This is available in all the controls, except the grid control.
If we change the name above to lblWelcome, and leave all the other parameters as they are, click on OK, the following code is inserted your XAML:-
Which generates this on your form:-
The Radio Button and Check Box controls aren't in the video, but a sample of the result of the XAML code generates this on your form:-
We have also added a Label and Entry option. This will generate an Entry field and an associated label control.
The generator screen is:-
which produces this code - and in turn this screen:-
Please let us know if you have any suggestions for additional controls, or the existing controls.