<UserControl x:Class="CustomDockingPanesFactory.ShellView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:local="clr-namespace:CustomDockingPanesFactory"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <local:ShellViewModel/>
    </UserControl.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal">
	        <Button  Content="Save layout" Command="{Binding SaveLayoutCmd}" CommandParameter="{Binding ElementName=RadDocking}" Margin="5,5,20,5"/>

			<Button  Content="Add Document" Command="{Binding AddDocumentCmd}" Margin="5"/>
	        <Button  Content="Add Left" Command="{Binding AddLeftCmd}" Margin="5"/>
	        <Button  Content="Add Right" Command="{Binding AddRightCmd}" Margin="5"/>
	        <Button  Content="Add Bottom" Command="{Binding AddBottomCmd}" Margin="5"/>

		</StackPanel>

		<telerik:RadDocking x:Name="RadDocking" PanesSource="{Binding Panes}" Grid.Row="1">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="Loaded">
                    <i:InvokeCommandAction 
	                    Command="{Binding OnLoadedCmd}"
	                    CommandParameter="{Binding ElementName=RadDocking}">
                    </i:InvokeCommandAction>
				</i:EventTrigger>
				<i:EventTrigger EventName="PreviewShowCompass">
					<i:InvokeCommandAction 
						Command="{Binding OnPreviewShowCompassCmd}" PassEventArgsToCommand="True"/>
				</i:EventTrigger>
			</i:Interaction.Triggers>

			<!--Close="OnRadDockingClose" PreviewShowCompass="RadDocking_PreviewShowCompass">-->
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup x:Name="DocumentHostPaneGroup"/>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup  x:Name="LeftPaneGroup"/>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedBottom">
                <telerik:RadPaneGroup x:Name="BottomPaneGroup"/>
            </telerik:RadSplitContainer>
			<telerik:RadSplitContainer InitialPosition="DockedRight">
				<telerik:RadPaneGroup x:Name="RightPaneGroup"/>
			</telerik:RadSplitContainer>
			<telerik:RadDocking.DockingPanesFactory>
                <local:MyDockingPanesFactory />
            </telerik:RadDocking.DockingPanesFactory>
        </telerik:RadDocking>
    </Grid>
</UserControl>
