Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How can I create field level help in Xamarin Forms MVVM project?

$
0
0

I have a Xamarin Forms project targeting iOS, Android and Window Phone. I am using MVVM for this project. All View Models are in a PCL and the UI is mostly in a shared project, such as ProjectUI. So, I have ProjectLib - contains the ViewModels, ProjectUI - the "shared" UI, ProjectUI.Android, ProjectUI.iOS, ProjectUI.Winphone.

Under ProjectLib, I have ProjectData - this defines all data objects that are used on both the client and server.

The app is generally running, but we have to come up with a way to add field level help to the app. To that end, we have added properties to the data that allow the user to define field level help.

If I have a property called FirstName, I would have another property called FirstName_Help. If FirstName_Help is non-blank, I'd like to change the style of the FirstName ("First Name:") prompt to show there is field level help for this field. Then, if the user taps the prompt, we'd like to pop-up a message with help text in it. If the FirstName_Help property is empty string, we do NOT want to change the prompt nor allow tapping on the prompt.

We have chosen this prompt method to reduce screen real-estate needed to depict there is help available, so I'd like to keep to this as our method if at all possible.

Because we are doing this via MVVM, I'd like to keep the code, if at all possible, in the View Model, not code behind. If we have to go with code behind, then we'll do that, but I'd love to keep it MVVM if at all possible.

I believe I can achieve the prompt change via a style, but I'm just not exactly sure how to go about doing it. The other challenge is how do I get the correct help text to display on the tap of the prompt?

I'd love to hear your thoughts on how this can be accomplished. Thanks in advance.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>