I am new to Silverlight and have been working with Simple MVVM to create a learning app. The Simple MVVM author provides several good examples of list/detail data binding but I’m looking an example of a screen to register a user. Since this is an internal app I can pass in the Windows ID from the hosting website and check it against the user database. If the user ID does not exist I would like to display a registration where the user can enter their first/last name and click a “register” button to save a new user record. Seems like a simple pattern but I haven’t been able to figure it out.
Share
Well I managed to combine a few different examples and come up with an example that works. This is part of a learning application that I am creating. It allows users (in my IT department) to suggest and vote for lunch destinations. For this app, the diner is the user. The code below will display a screen with the user’s windows ID (read only) and inputs for first/last name in addition to a “register” button.
XAML (registerdinerview.xaml):
View Code behind (registerdinerview.xaml.cs):
ViewModel:
using System.Collections.Generic;
// Toolkit namespace
using LTDestination.Services;
using LTDestination.Web;
using SimpleMvvmToolkit;
namespace LTDestination.ViewModels
{
///
/// This class extends ViewModelDetailBase which implements IEditableDataObject.
///
/// Specify type being edited DetailType as the second type argument
/// and as a parameter to the seccond ctor.
///
///
/// Use the mvvmprop snippet to add bindable properties to this ViewModel.
///
///
public class RegisterDinerViewModel : ViewModelDetailBase
{
#region Initialization and Cleanup
}