Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Design Time Data for Xamarin.Forms

In my previous post I showed how to switch between Visual States using the tooling that comes with the BuildIt.Forms library. One of the other features of the tooling is the ability to load mock data that can assist with visualising how a page might look like with certain data. Rather than try to guess at what data your page might require, the tooling simply allows you to define a series of design actions. Each design action will appear within the BuildIt.Forms flyout, allowing you to invoke the action.

Let’s demonstrate this with an example. I’m going to change the layout of my page slightly so that in the DataLoaded state a ListView is displayed that takes up the entire screen. The XAML for the ListView is as follows:

<ListView x:Name="DataList" IsVisible="false">
     <ListView.ItemTemplate>
         <DataTemplate>
             <ViewCell>
                 <Label Text="{Binding Name}" />
             </ViewCell>
         </DataTemplate>
     </ListView.ItemTemplate>
</ListView>

As I don’t have any actual data at the moment, when I run up the application and click the Load Data button I see the following for the DataLoaded state:

image

This isn’t great as I’ve got no idea what my ListView is going to look like. So let’s fix this by adding a design action. I do this by calling the AddDesignAction method (it’s an extension method which is why I can access it on the MainPage) and providing a name, “Mock Data”, and the action to perform when the design action is run.

public MainPage()
{
     InitializeComponent();

    var groups = VisualStateManager.GetVisualStateGroups(this);
#if DEBUG
     this.AddDesignAction("Mock Data",
         () =>
         {
             var data = from i in new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
                        select new { Name = $"Item {i}" };
             DataList.ItemsSource = data;
         });
#endif
}

In this case I’m creating an IEnumerable of an anonymous type that has a property Name, which aligns with the data binding in the ListView XAML shown earlier. I’m assigning this directly to the ItemsSource of the ListView – at this stage I’m just creating the layout of the pages of my application so I might not even have View Models, which is why I’m assigning directly to the ItemSource property in place of data binding it.

Now when I run the application I see:

imageimage

imageimage

The final image shows the list of items being displayed in the ListView – clearly this layout could do with some work!

Comments are closed
Why do Australian Telcos make life so hard!

Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Why do Australian Telcos make life so hard!

For a while now (in fact as long as I can remember) people have been complaining about Australian telecommunication companies, in particular Telstra.  Well today I decided to do the rounds of Optus and Telstra to see just how bad they really are.  A couple of weeks ago I got a 3 mobile broadband data card for my laptop so I got to experience that process too.  Here's a bit of a wrap up about my experience in each case:

The 3 Network

Out of the three networks I sampled 3 was by far the cheapest in terms of mobile data packages - $29 for 1Gb and combined with their capped plans is probably the best for the average business user.  Unfortunately they don't support devices that aren't HSDPA compatible, so my HTC Touch won't even connect to the phone part of the network.  Their plans are also excessively long, requiring you to commit to 24 months (this might be true of the other networks but I didn't get to the point of asking!).

In terms of customer services, once someone realized that you were waiting, and not just specing out phones, they were quite attentive.  That is until you agree to purchase something at which time their brains seem to drift off and the process which should have taken 5 minutes took almost 20 minutes.  Most of the staff, while friendly, are completely useless as they have shallow, if any, knowledge of either the phones or the network itself.

Optus

This network was by far the worst for customer service.  I guess it didn't help that I went in at lunchtime and there were a number of people waiting to be served.  Being slightly impatient I decided to grab one of their information brochures and flip through it.  Coming across their data plans I noted that at $29 for something minimal like 100Mb they were almost 10 x more expensive than 3. 

When I finally did get served, by a staff member who was hiding in the back room despite numerous people waiting, I asked why this might be they said "because that's the price it is...." - not very helpful.  I asked whether that was it, or whether he was able to provide any further assistance before turning on my heels and leaving.

Telstra

As I walked into the Telstra shop I was immediately greeted by on of the sales assistance who wasn't at all pushy but was able to provide useful/knowledgeable information on their network and their pricing.  Whilst Telstra also charge an arm and a leg ($29 for 70Mb) they were at least able to give a reason - This price applies to both their HSDPA service (NextG) but also their GPRS data (3 charge like a wounded bull when you drop back to GPRS mainly because it isn't their network).  Telstra also has much better coverage than any of the other carriers which helps to justify the high price.

The big word of caution about the Telstra network is that you have to use a Telstra approved device.  Even if the device is marked as supporting HSDPA it might not work on the Telstra network - big gotcha for rookie players.  They also don't support people with 2G only phones that want to move across without going up to NextG plans.

 

In summary, Australia is in a sorry state of affairs - how can data be so expensive for mobile users and the carriers be so incompetent?

Comments are closed