### How do I upgrade my layouts to v2?

269
views
0
4 months ago by
I've got a warning, stating, that my layouts are outdated and need update. How do I upgrade them to v2?
Community: Stack WM

2
4 months ago by
V2 makes layouts permanently visible on the screen (so that you could see window tabs for example). That means, that anything in your layout, that is not transparent, will now always be visible on the screen.

For example, some V1 out of box layouts had blue <Border> elements in them. If you'd simply mark layout as V2, those would be visible over your windows all the time. That needs to be corrected before you start using V2 features in your layout.

So here are the steps:

1. If any of your <Zone> elements had Background set, remove it completely, or make it visible only when hints are enabled (this happens when you start dragging windows with middle mouse). For example, default Zone does it like this:
<!-- see http://www.wpf-tutorial.com/styles/trigger-datatrigger-event-trigger/ -->
<DataTrigger Binding="{Binding ShowHints}" Value="True">
<Setter Property="BorderBrush" Value="Black"/>
</DataTrigger>​
2. If you had hints, there's a simple way to make them appear only when needed: set zones:Layout.IsHint="True"
<Border zones:Layout.IsHint="True">...</Border>​
3. On your root element (usually the very first <Grid> at the top), indicate, that your layout is now v2 to remove the warning:
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:zones="clr-namespace:LostTech.Stack.Zones;assembly=Stack"
mc:Ignorable="d"

zones:Layout.Version="2"

Width="1024" Height="576"
d:DesignWidth="1024"
d:DesignHeight="576"
>...</Grid>​

That's it. After that you should be able to use new Stack WM features, like tabs and dynamic arrangement. See out of box layouts for examples.