Errata

Programming Windows Store Apps with C#

Errata for Programming Windows Store Apps with C#

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 1
First 4 chapters

First 4 chapters are missing.

Marcus Bailey  Oct 20, 2012 
Printed Page 19-23
Starting on Page 19 where the XAML is reproduced

It took me awhile to narrow down the issues related to using the instructions in the book to create the Street.Foo.Client.

My computer has Windows 8.1 as the OS. The IDE that I'm using is Visual Studio Community 2013 Version 12.0.31101.00 Update 4

When I created the Windows Store App (C# version), the XAML code for RegisterPage.xaml shows:

<Page
x:Name="pageRoot"
x:Class="StreetFun.Client.UI.RegisterPage"
....
</Page>

However, on Page 23, at the top of the sample XAML code you see:

<local: StreetFooPage
x:Name="pageRoot"
x:Class="StreetFun.Client.UI.RegisterPage"
....
</local:StreetFooPage>

This may just be an issue with the printed version, but I did not see a statement of how or why the XAML code should reference StreetFooPage.

After digging into the source code in Chapter 1 from the Git download, it is apparent that a folder/subdirectory in the StreetFoo.Client.UI must be created and it must be called Objects. Perhaps the VS Studio version the authors used caused the Objects folder/subfolder to be created when the Windows Store App project was created but my VS Studio IDE did not created it. I had to add this subdirectory and then add an existing item StreetFooPage (from the Git download) to this subdirectory and then change the RegisterPage.XAML to match what is on Page 23.

I think there may be some verbiage about what StreetFooPage is, where it needs to be located and it's purpose that is missing in the printed version of this book.

Once I made the above changes, I moved on to other changes that may be strictly due to my IDE. The XAML code generated for the RegisterPage. XAML is missing entirely the AppBarButton XAML code.

In its place is some kind of Button code (see below)

<!--<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>-->

As you can see, I commented out this Button code and put in its place the AppBarButton code from the book with the exception of the Converter code that halts the build. Lou and I seem to have the same issue on this converter and I've just chosen to not include that code.

This again may be due to my version of the IDE, but I had no VisualStateManager comment in my RegisterPage.XAML code. So I had to create another Grid segment after the one that surrounds the AppBarButton and TextBlock referencing the pageTitle. If I did not do this, when I ran the application, the username, email. etc. rolled up off the top of the screen.

My additional Grid segment looks like:
<!-- Registration Form -->
<Grid Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="1" Grid.Row="1">
....
</StackPanel>
<Grid>

While trying to resolve the issue as to what StreetFooPage was, I noticed in the Git download, the existence of another Objects folder within the Windows Store App Class Library StreetFoo.Client which housed the ErrorBucket class. It may be just the print version, but I did not see anything that directed me to create this second Objects subdirectory and place the ErrorBucket class within in it.

This got me to take a closer look at the Git download for Chapter 1 and I discovered that the Objects subdirectory in the StreetFoo.Client.UI project also had the PageExtender class in this subdirectory.

This may just be a problem with the printed version, but on Pages 36 through 38, it is not clear that ErrorBucket.cs and PageExtender.cs need to be in these Object subdirectories. Had I not looked into what StreetFooPage was, I would not have tripped over the location of these two other classes. Based on my reading of the book, I originally placed them in the StreetFoo.Client Class Library but at the same level as that of IViewModel, ViewModel, RegisterPageView, etc.

I think I answered my question about Page 39 and the Inheritance issue. The page clearly shows:

public RegisterPageViewModel(IViewModelHost host)
: base(host)
{
this.RegisterCommand = new DelegateCommand((args) => DoRegistration());
}

But in the download from Git, this code does not exist. Instead, there is only one constructor - the default constructor and it has
this.RegisterCommand = new DelegateCommand((args) => DoRegistration());
in it.

So I commented out the second constructor I added just to make the build run and placed the RegisterCommand (pointing to the DoRegistration method) into the RegisterPageViewModel default constructor.

With the above modifications, I now have the application running and giving me error messages like it should. It's been interesting researching and resolving the issues but I do overall like this book as I move on to Chapter 2.

Thank you.

Anonymous  May 03, 2015 
Printed Page 23

Am I doing this wrong? I am trying to work my way through the examples. In the xml on this page, there is a reference "BooleanToVisibilityConverter", and I get "the resource could not be resolved". Do I need to be concerned about this?

Lou  Dec 30, 2014 
Printed Page 39
First and after second paragraph in sample code

In paragraph one, first complete sentence, I believe the word "comments" should read "command"

Also, after the second paragraph on the same page in the sample code, the RegisterPageViewModel class (which inherits from ViewModel in particular), indicates that ViewModel has a constructor that takes a IViewModelHost parameter. Maybe I missed something, but my ViewModel constructor has only a default constructor as shown on page 33.

When I went to build just prior to finishing Chapter 1, compiler complained about ViewModel not having a constructor with 1 parameter. To resolve the issue and get a clean compile, I added the requested constructor to ViewModel.

Also, I encountered same issue as Lou regarding the IsBooleanVisibility. I just removed the code that was highlighted for this error to get a clean compile and have not yet encountered the issue that IsBooleanVisibilty is supposed to resolve.

Thank you.

Anonymous  May 02, 2015 
Printed Page 60,66

On Page 60, the sample code does not match up with what is expected when the interface IRegisterServiceProxy is inherited on Page 66. The method name is Register on Page 60 and RegisterAsync on Page 66. Is there a step missing or is this just perhaps a typo?

Thanks

Anonymous  May 09, 2015 
Printed Page 66
top of page - sample code for RegisterResult class

I am confused as to where the parameter "bucket" on this page refers to in the : base(bucket). My build complained that it did not recognize "bucket".

I reviewed the ErrorBucket class in the Git download for Chapter 2 and noticed it has a lot more code that my class but nothing seemed to address the whereabouts of "bucket". I commented out this part of the constructor to make the compiler happy.

When I ran the app, it had a NullReferencePointer error on the Host when the async ShowAlertAsync message attempted to execute. The presumption here is that the server did not encounter any errors and a message needs to be displayed on the screen.

I looked for anything that caused Host to be instantiated and found nothing. I haven't been coding C# for very long but I looked everywhere for it. So, I placed code model.Initialize(host) following the initialization of the model via TinIoC. I don't know if it is possible to have TinyIoC return a concrete object that contains the Host. It seemed to just return a object that did not have Host initialized.

Once I had the Host initialized, the app ran but incorrectly displayed a successful message. It seemed not to realize that the server had returned an error to my registration. The error is username already on file. This is where I think "bucket" was meant to come into play.

The fact that an error has occurred from the server was not being passed up the chain. The variable result in the RegisterPageViewModel was not able to access this fact and fell through to the positive message that a new user has been created - which was not true.

To get var result to recognize that an error had indeed occurred, I created a public property called Bucket of type ErrorBucket in the RegisterResult class and in the internal RegisterResult method, I set the property Bucket to the error parameter that was passed into this method. Then I had to change the test in RegisterPageViewModel to:
if (!(result.Bucket.HasErrors))

The test now works and correctly the error message the server returns shows up as it should.

I'm not sure this is the correct way this app is supposed to work at this point in Chapter 2 but in the next edition of this book, you might want to get this resolved as it took me quite awhile to track down the source of the error and create a workaround.

Thank.

Anonymous  May 09, 2015 
Printed Page 66
sample code at top of page

After reviewing the use of base in inheritance, I looked over my code once more and realized I had assigned the ErrorBucket object the parameter name error which contradicted the parameter name bucket.

Once I made both parameter names bucket, the code worked without the additional property Bucket.

Sorry for my mistake but I still have no resolution as to the instantiation of Host without the use of model.Initialze() in the Page Extender class.

Thanks.

Anonymous  May 10, 2015 
Printed Page 76
code sample for progress bar

I think the answer to the missing "BooleanToVisibilityConverter" is in the IDEs that Lou and I are using and the one the authors used. I had read in another reference that VS 2013 had removed some items from the Common subfolder which is created when we add a Basic Page. VS 2012 added a lot of things in this subfolder when you created a Basic Page that VS 2013 apparently does not.

To resolve the error, I just added an existing item to the StreetFoo.Client.UI Common folder and pointed it to import the one found in the download from Git. No more complaints from compiler now.

Thanks.

Anonymous  May 12, 2015 
Printed Page 76
Sample Code

The converter should be:
BooleanToVisibilityConverter

the printed version has VisibilityConverter

Anonymous  May 16, 2015 
Printed Page 78
Sample code

Property BusyCounter should be BusyCount

Anonymous  May 16, 2015 
Printed Page 78
Sample code

The code on Page 78 references the property IsBusy but does not display the setup of this property within the ViewModel class.

As a beginner with C#, it would have been helpful to include the code showing the setup of the IsBusy property:

// indicates whether the view model is busy...
public bool IsBusy
{
get { return GetValue<bool>(); }
private set { SetValue(value);

Just saying...

Anonymous  May 16, 2015 
Printed Page 99
Code sample in the midde of the page

On Page 99 there is a reference to the LogonAsync method in the StreetFooRuntime; however, the only change to the StreetFooRuntime class on Page 95 references only a change to getting a connection to the System Database and creating the table asynchronously.

Also, the code under // get handler comment on Page 99 is now:
// get handler...
ILogonServiceProxy proxy = ServiceProxyFactory.Current.GetHandler<ILogonServiceProxy>();

where it use to be:
// get a handler...
var proxy = TinyIoCContainer.Current.Resolve<ILogonServiceProxy>();

Maybe I missed it, but I did not read in the printed version why TinyIoC was swapped out for the ServiceProxyFactory. At this time in the walkthrough, I am sticking with TinyIoC.

Thank you.

Anonymous  May 16, 2015 
PDF, ePub Page 107
1st paragraph, 5th line

Typo in sentence: "of"
"What I?m going to do throughout of work is create a shared library of styles and keep reusing it as we go."
Maybe it should be "our" instead of "of"?

Anonymous  Feb 19, 2014 
Printed Page 115

The statement on Page 115 to run the application and have it display the one fake report will not work without significant changes in the LogonPageViewModel class.

I had to add statements (see below) to just before the message to indicate that the logon was successful.

IViewModel model = new ReportsPageViewModel();

// show the reports page...
this.Host.ShowView(typeof(IReportsPageViewModel));

I also commented out the alert message that the logon was successful. The comment and statement to show the reports was not in the printed version of this book as a necessary part of this class but it was in the download from Git. The statement creating the model I added as it was not in the Git download and the fake report would not be created without it.

Although I followed the manual regarding the creation and modifications of the ReportsPage and ReportsPageViewModel, I could not get the test reports to appear after I had the fake report show up and yes I did comment out my code to create the fake report.

After a lot of compare and contrast between my code and that of the Git download, I found that in the ReportsPage.xaml.cs the following statement:

private IReportsPageViewModel Model { get; set; }

The printed version of this book (as far as I can tell) does not hint that this statement is a requirement to display the test data created in Appharbor.

I have found WinMerge an invaluable tool in discovering code differences between what is in the printed version of this book and the Git download for the chapter I've been working. However, it would help if there was some discussion as to why the code in the Git download looks the way it does. I learned a lot about DI and IoC and other methodologies from this book but when code is introduced only in the downloaded Git code with no explanation, it's difficult to determine why that code is there.

Thank you.

Anonymous  May 22, 2015 
Printed Page 130

I'm not able to get the AppBar to appear when multiple selections are made.

After running through debug, the problem seems to be with the MyGridView class when it's referenced.

Debug window shows the following error:

Error: BindingExpression path error: 'DefaultViewModel' property not found on 'StreetFoo.Client.UI.ReportsPage'. BindingExpression: Path='DefaultViewModel' DataItem='StreetFoo.Client.UI.ReportsPage'; target element is 'StreetFoo.Client.UI.ReportsPage' (Name='pageRoot'); target property is 'DataContext' (type 'Object')
The program '[3140] StreetFoo.Client.UI.exe' has exited with code -2146233082 (0x80131506).

I do not know why MyGridView is not aware of this property in the ReportsPage but I've not been able to resolve this one so for the moment, I'm bypassing the extension of the GridView.

Thank you.

Anonymous  May 24, 2015