I want to prevent the ViewModel from beeing created at Designtime.
So, the header looks like this:
<UserControl x:Class="app.reports.sta"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:viewmod.reports.sta;assembly=viewmodAss"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="1200"
d:DataContext="{d:DesignInstance Type=vm:staViewModel, IsDesignTimeCreatable=False}"
Language="de-DE">
The DataContext is set as shown below:
<UserControl.DataContext>
<vm:staViewModel/>
</UserControl.DataContext>
<!--With this part active, the designer throws an error from the viewmodel constructor -->
<!--Without this part, the designer works, but when the app is run, not data is displayed (which is quite obivous) -->
How can I set the DataContext
so that the ViewModel won't be created at DesignTime?