I am having trouble converting an eventhandler into a command using MVVM design and the Prism toolkit.
I'm also using the WPToolkit -- the DatePicker. I need to set the ValueChanged event to a command.
Here's my code:
MainPageViewModel
_setDateOne = new DelegateCommand(delegate()
{ });
void picker1_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
{
using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isf.FileExists("DateOne"))
isf.DeleteFile("DateOne");
IsolatedStorageSettings.ApplicationSettings["DateOne"] = e.NewDateTime.Value;
IsolatedStorageSettings.ApplicationSettings.Save();
}
}
Xaml
<toolkit:DatePicker Name="picker1" ValueChanged="picker1_ValueChanged" Value="{Binding DateOne, ElementName=this, Mode=TwoWay}"/>
I know the XAML is wrong; I don't know how to do it properly, yet.
Sorry, I'm pretty newbie with programming and especially MVVM.