Customizing get and set binding logic
Data binding is not just about connecting a UI element to a data source. It’s also about how data is retrieved and updated. Customizing these get
and set
operations makes state management and data flow more flexible. In this recipe, I’ll guide you through the caveats of using get
and set
explicitly and executing asynchronous logic when setting values. These mechanisms will allow you to simplify your code and take even greater control of the interactivity of your Blazor application.
Let’s implement a simple text field with explicit get
and set
operations so we can execute additional, asynchronous logic as binding is commencing.
Getting ready
This time, we will take a shortcut with preparations for this upcoming recipe:
- Create a
Recipe04
directory – this will be your working directory - Copy your
IntroduceYourself
component from the Performing asynchronous actions after binding recipe or copy its implementation...