I am binding a textbox to an object, like so:
<TextBlock d:DataContext="{d:DesignInstance ViewModel:TaskVM }"
Text="{Binding Title}" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown">
</TextBlock>
Now I am wondering how to make it display mock data during design. I've tried doing something like that:
<TextBlock Text="{Binding Path=Title}" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown">
<d:DesignProperties.DataContext>
<ViewModel:TaskVM Title="Mock"/>
</d:DesignProperties.DataContext>
</TextBlock>
However, since TaskVM has no default ctor, I am getting a "No default constructor" found.
I know that when I use d:DataContext="{d:DesignInstance ViewModel:TaskVM }"
it creates a mock data type. Is there a way for me to set the properties of this mock type?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…