DesignInstance not working in VS2012

后端 未结 4 1824
面向向阳花
面向向阳花 2021-01-01 18:40

I just spent several hours on an issue when using VS2012, WPF 4.5 and design-time data, specifically the DesignInstance attribute.

Goal: I wanted to

4条回答
  •  清酒与你
    2021-01-01 19:25

    I ran into this error myself in VS2013 then found this question. After searching more, I found an answer that helped me solve it.

    instead of

    d:DataContext="{d:DesignInstance vm:DesignAlertsViewModel, IsDesignTimeCreatable=True}"
    

    use

    d:DataContext="{d:DesignInstance d:Type=vm:DesignAlertsViewModel, IsDesignTimeCreatable=True}"
    

    I was using "...d:DesignInstance Type=vm:..." and that displays the same error described above. As soon as I add "d:" everything works.

    Here is the thread I found that helped.

    https://stackoverflow.com/a/21690404/2892400

提交回复
热议问题