How can I build a calorie calculator app with .NET 8?

Hailey Frod 0 Reputation points
2025-09-06T14:41:10.1566667+00:00

I’m learning .NET 8 and want to make a small app as practice. The idea is a Link removed

I’m not sure how to start this project:

Should I make a desktop app, web app, or mobile app in .NET 8?

How do I create a simple form where a user chooses a drink, and the app shows calories?

Is there an example or tutorial in Microsoft Learn that could help me with this?

Any guidance or beginner-friendly resources would be appreciated.

Developer technologies | .NET | Other

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Oldest
  1. Adiba Khan 2,355 Reputation points Microsoft External Staff
    2025-09-08T09:22:55.0333333+00:00

    Here’s how you can approach it step by step:

    1.      Decide on the app type

    ·         Desktop (WinForms/WPF): easiest for beginners, runs only on Windows.

    ·         Web (ASP.NET Core): accessible from browser, good if you want to learn web development.

    ·         Mobile/Desktop (MAUI): works across android, IOS, Windows, Mac- best if you want cross-platform.

    For learning, I recommend starting with .NET MAUI because you’ll learn modern UI and can reuse your skills for desktop and mobile.

    2.      Basic Project Setup

    ·         Install the latest .NET 8 SDK and Visual Studio 2022/2025 with MAUI or ASP.NET workloads.

    ·         Create a new project:

                                                                  i.            For desktop/mobile -> “.NET MAUI App” template.

                                                                ii.            For web-> “ASP.NET Core Web App (Model-View-Controller)” template.

    3.      Create a simple form (UI) by learning from the link below:

    Get started with .NET MAUI XAML - .NET MAUI | Microsoft Learn

    4.      In code-behind (C#)

    Create a function OnCalculateClicked

    {

                    Var drink= DrinlPicker.SelectedItem?.ToString();

                    Int calories = drink switch

                    {

                                    “Coffee” => 5,

                                    “Tea” =>2,

                                    “Soda” =>150,

                                    _ =>0

                    };

                    ResultLable.Text= $”Calories {calories}”;

    }

    5.      Expand Functionality

    ·         Store drink/calorie data in a JSON file or database.

    ·         Let users add their own drinks.

    ·         Show total calories for a day.

    6.      Learn from official tutorials

    ·         Get started with .NET MAUI XAML - .NET MAUI | Microsoft Learn

    ·         Get started with ASP.NET Core MVC | Microsoft Learn

    ·         Write your first C# code - Training | Microsoft Learn

    Was this answer helpful?

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more