They may have removed the sample data functionality in the latest versions of Blend, but have no fear, you can still accomplish effective Designer/Developer workflows using custom design data and the Model-View-ViewModel (MVVM) Pattern. I was setting up the sample data functionality on our latest mobile project and I wanted to write this quick blog post to help others setting up the same thing. To start I created our Windows Store application, added the Caliburn.Micro NuGet package, and created the initial View and ViewModel for our Hub page.
In this post, I’ll show you how to create an extension method for the bool class that will simplify your .NET code in XAML-based apps (either WPF or Silverlight). In particular, this extension method addresses the fact that the Visibility property of UI controls in XAML is not a Boolean (true/false) value (as has traditionally been the case for both Windows Forms and ASP.NET). Instead, it’s one of three possible enumerated constant values: Hidden, Collapsed, and Visible.
Visible obviously means “visible,” while both Hidden and Collapsed mean “invisible.” The difference between Hidden and Collapsed is merely whether or not the invisible control occupies blank space on the screen that it would occupy if it were visible. Collapsed consumes no space, while Hidden does.
It’s nice to have the three options, but in most cases you’ll find that you just need the two…