WPF, visibility and hiding controls using presentation models
In WPF, the data context for a control often sets the range of data available for binding. Using a presentation model, you can provide properties that are easy to bind to and provide some conditional display logic. For example, if your presentation model has the following fields: bool HasTitle { get; } string Title { get; } IList DataList { get; } Then you can use these fields to bind. For example, create a new UserControl and in code (say in a spring container) set the DataContext to the presentation model. Then in the resource section of the control: <UserControl.Resources> <CollectionViewSource x:Key="dataList" Source="{Binding Source=DataList}"/> </UserControl.Resource> then use this as the source for your list views, etc. Gn the section where you define the controls that make up the user control you can toggle the visibility of different elements: <Style x:Key="smallTitleStyle" TargetType="TextBlock"> ...