Prøve GULL - Gratis
Exploring .NET MAUI: Data Entry Controls and Data Binding
CODE Magazine
|November - December 2024
In the first parts of this ongoing series on exploring .NET MAUI (https://codemag.com/Article/2408041/Exploring-.NET-MAUIGetting-Started and https://codemag.com/Article/2409041/Exploring-.NET-MAUI-Styles-Navigation-and-Reusable-UI), you created your first .NET MAUI application and ran that application on both a Windows computer and an Android emulator.

You created data-entry pages, partial pages to reuse on those pages, and you navigated among those pages. In this article, you’ll continue to use more data entry controls and learn to perform data binding between controls. You’re going to create a class with properties that you can bind to controls on a page as well. When you change the values of properties in a class, you need to raise a PropertyChanged event so the UI can update those controls that are bound to the properties. You’re going to create a base class that helps you raise that event any time the property values change.
Use a Switch Control for Yes/No Input
Simple entry controls allow a user to enter any data they want. For some input you need a simple yes or no answer from the user. For example, if you have a Boolean property such as IsEmployed on a business object, use a Switch control to represent the two states for this property. On a Windows computer, the Switch control appears as a toggle coupled with a label next to it with the words On and Off, as shown in Figure 1.
Open the Views\UserDetailView.xaml file and add an Auto to the RowDefinitions attribute of the Grid control. Locate the last <HorizontalStackLayout> starting tag at the bottom of the Grid and change the Grid.Row property to "7" instead of "6". Just before the <HorizontalStackLayout> starting tag you just modified, add the following XAML that creates the Switch control:

Run the application and click on Users > Navigate to Detail to see the switch control. Click on the Switch control a couple of times to see the labels change.
Denne historien er fra November - December 2024-utgaven av CODE Magazine.
Abonner på Magzter GOLD for å få tilgang til tusenvis av kuraterte premiumhistorier og over 9000 magasiner og aviser.
Allerede abonnent? Logg på
FLERE HISTORIER FRA CODE Magazine
CODE Magazine
Identifying and Reducing Test Case Combinatorial Explosions with Python's Abstract Syntax Tree (AST) and Pytest Framework
Test matrix explosions are a growing challenge in modern software testing, especially when using parameterized tests in machine learning pipelines.
3 mins
July - August 2025

CODE Magazine
The New Features and Enhancements in .NET 10 H
By the end of this year, Microsoft plans to release .NET 10 (in November 2025). Incidentally, it will be a Long-Term Support (LTS) release. The preview version of .NET 10 is already available.
2 mins
July - August 2025
CODE Magazine
Unlocking Angular Performance: Optimization Techniques
Optimizing Angular applications for speed and efficiency requires a deliberate strategy.
2 mins
July - August 2025
CODE Magazine
Git Branching Strategies
Sometimes when we reach for the stars, we forget to keep our feet on the ground. Whenever I sit down to write these articles, I wonder what I should write about.
6 mins
July - August 2025
CODE Magazine
Sending Email with SendGrid
C# provides several ways to send email. Maybe you've used the SMTPClient class or perhaps you've used the Mailkit NuGet package, which is what Microsoft recommends for new code.
4 mins
July - August 2025
CODE Magazine
Natural Language Al-Powered Smart UI
Looking for real-world AI examples is a challenge and part of this challenge comes from Generative AI (GenAI) news dominating the media. It feels like every AI demo involves chatting with GenAl to produce content. The obligatory chat completion demo has started to become the to-do list of AI demo apps, and, to make matters worse, it's selling AI short.
9 mins
July - August 2025

CODE Magazine
Three Conferences, One Destination: MAXIMIZING YOUR AI-ERA LEARNING INVESTMENT
MAXIMIZING YOUR AI-ERA LEARNING INVESTMENT
4 mins
July - August 2025
CODE Magazine
Exploring .NET MAUI: Popups, Messages, and Data Validation
Through this article series, you've created several .NET MAUI pages, performed navigation, used data binding, and worked with the MVVM and DI design patterns. As you created your view models, you've set information and exception message properties. In this article, you'll build reusable components to display information, error, and validation messages on your pages. To validate
11 mins
May - June 2025
CODE Magazine
Unlock Serverless Azure Functions
The evolution of cloud computing has transformed how developers build and deploy applications. One of the most significant shifts in this evolution is the rise of serverless architecture. Traditionally, building and maintaining applications requires managing servers, scaling infrastructure, and handling operational concerns.
10 mins
May - June 2025
CODE Magazine
Securing ASP.NET Core Blazor Applications
Blazor is a modern web framework from Microsoft used for building interactive web applications using C# and .NET. It's based on a flexible, modular component model well suited for building applications with rich, interactive web user interfaces. Blazor leverages the authentication mechanism of ASP.NET Core to establish the identity of a user.
5 mins
May - June 2025
Listen
Translate
Change font size