I am creating a user control to display a note. Therefore, I have a NoteViewModel. In my designer I want to have a test note. Therefore, in my XAML there is the following:
<UserControl.Resources>
<local:NoteViewModel x:Key="ViewModel" d:IsDataSource="True">
<local:NoteViewModel.Note>
<localweb:Note
NoteID="1"
CreatedBy="Some Guy"
CreatedDate="2010-01-01 8:00 AM"
Category="Some Category"
NoteText="Some Text"
/>
</local:NoteViewModel.Note>
</local:NoteViewModel>
</UserControl.Resources>
This works great during development. But at runtime, I get errors in that I cannot convert “1” to Int32 and cannot convert “2010-01-01 8:00 AM” to DateTime. Why can a developer handle this, but not at runtime? How can I change my XAML so that the designer can show the test note, but the runtime will not work?
source
share