In my WPF App, I have designed the Form using Expression Blend. To my surprise, the rendering is quite different when I load the solution using Visual Studio 2008. What is even more surprising, when I run the application, the resulting UI is different from the rendering done by both VS and Blend. Though I have not provided by XAML code, but in general is this a known Issue?
问题:
回答1:
This is most definitely a known issue. Visual Studio uses what's known as the Cider designer to render WPF code. It most definitely renders XAML differently from Blend. Cider in VS2008 is pretty terrible, but gets much better in 2010 (but is still pretty terrible compared to Blend). One of the main differences between Cider and Blend is that Cider will read the code behind file (*.xaml.cs) while Blend will completely ignore it. Another notable difference is that Cider doesn't really understand things like Visual States and Blend SDK Behaviors (especially when you mix the two) while Blend completely understands them.
If you're constructing your view classes where you set your DataContext in XAML and then provide design time data (using Blend or a view model locator), you'll find that there are very few differences between Blend and how something actually looks at runtime.