Part 9 - Exercise: Tip Calculator

Play Part 9 - Exercise: Tip Calculator

The Discussion

  • User profile image

    I see that when you put in the "TextBlock" for the text "Tip Calculator", the text appears at the top in the same line as the status bar where the signal and battery level are located.  But I didn't see that in my preview screen inside my Visual Studio preview pane, why is that?

    FYI, I am using MS VS Express 2013 for Windows.

  • User profile image

    I got a FormatException when I click on the bill amount text block because I'm in Belgium and (I think) the system use "," instead of ".". In the documentation of Parse method that is culture-specific.

    Any idea to fix this ?

  • User profile image

    The main page does not scroll. When I turn the phone orientation to horizontal, I cannot see the tip amount and total amount fields, and it does not allow scroll! Is this a fault with Grid control? Thanks.

  • User profile image

    I guess you'd have to add a scroll viewer...

  • User profile image

    How would you rewrite the query to check which radio button is check, instead of this form

    var selectedRadio = myStackPanel.Children.OfType<RadioButton>().FirstOrDefault(r => r.IsChecked == true);

    but in the LINQ format? I tried
    //var selectedRadio = from RadioButton in myStackPanel.Children
    //where RadioButton.IsChecked == true
    //select RadioButton;

    but doesn't seem to work. Can anyone explain why?

  • User profile image
    rakesh singh

    @frank : has a good quick tutorial to add scrollviewer to the page.

  • User profile image

    I tried this on my physical device after trying on emulator and it is not working. I am from India and my phone's currency is rupee and I guess that is the reason for it not working. I also changed the region and language of the emulator to India and English(India) and there is this same problem not working on emulator as well. Why does this happen bob?

  • User profile image

    I'm having an unusual problem. The app works fine only when I select the "radio button" first and then input the Bill amount. But when I'm trying to input the "bill amount" first, it gives me an error.


    UnhandledException += (sender, e) =>
    if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();

  • User profile image

    I was trying to find autosize property for the billAmountTextbox,so that if I enter the value of more than 3 digits..then it is shown properly..
    Could you help.!!

  • User profile image

    I did something like this, I guess this'll help.

    Add these lines to the textbox property





    That resolves the problem when someone tries to mess up with it ;)   

  • User profile image

    I had a problem when no radio button had been checked at the beginning and it threw an unhandled exception if I tried to add an amount before checking a radio button. The solution is to make one radio button checked by default and it should work. If anyone has the same problem, just add


    in XAML to any radio button.

  • User profile image

    Don't you think that you over complicate the code by using a non-standard coding solutions to simple problems. Like the decision to use String instead of keeping it Double. Also the way to check the selected Radio button is way over complicated that I couldn't understand even that I am an experienced C# Developer.

  • User profile image

    Hello!, i have the same problem of "fahadkz" when run the app in the emulator, appears that can´t calculate the tip amount, appear the amount on euro € and my curruncy is $ mexican pesos MXN, can´t do anything, i wrote the same app several times and it´s the same mistake, this is the link of source code that have this course(lessons) but the objective of the course it's make it for yourself.

  • User profile image

    Hello again!!! about the problem of yesterday, finally i´ve found the problem and it´s in the File"Package.appxmanifest" in the Solution Explorer, you have to change the language default "es-ES"(this is my language default because i´m from méxico) to "en-US", if you don´t change the language default, doesn't work correctly the application, i hope to be helpful.

    Thank you for the attention on this page.

  • User profile image

    Hello there!

    Had some difficulties here, a strange bug appeared as I first ran the API in the simulator : as I was trying to type a bill amount, the API threw me a format exception, saying that I was trying to transform a string to a date. Thanks to Omar just beneath in the comments who gave me the solution, I just had to change the default language in the Package.appxmanifest to "en-US" (as it is not my native language) and everything ran out correctly.


  • User profile image
    Marcus Teixeira

    I'm trying to do this Tip Calculator in VB. I don't know much VB but I know VB more I than C#. I had some help from a Code Converter but it keeps getting stuck in the PerformCalucation() Method... The are no squiggly lines and it builds to success..

Add Your 2 Cents