This is a migrated thread and some comments may be shown as answers.

Stretch Vertically and Horizontally Docking Control

4 Answers 1470 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Igor Diamant
Top achievements
Rank 1
Igor Diamant asked on 29 Jul 2014, 08:11 PM
Hi,

I am using version 2014.1.224.45 of UI for WPF. I need to make my docking control fill all my client area of its parent UserControl.

If i do not explicitly define a Height I receive the error: "Placing Docking control in a panel or control that measures it with infinite width or height is not supported in the current version."

Is it possible?
How can I do this ?

If the is not really possible which events I must drive to define explicitly the heit as the hight of the parent. I have treid the SizeChanged Event of the parent bit it did not work.

Thanks in advance


4 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 30 Jul 2014, 12:55 PM
Hi Igor,

I assume you have placed the control in StackPanel, which measures it with infinity and this is causing the exception. Please try placing the Docking inside of a Grid it will fill all of the available space and let me know if it works for you. If not I will ask you share some more details about the exact layout you are using.

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Igor Diamant
Top achievements
Rank 1
answered on 30 Jul 2014, 01:20 PM
Hi Kalin,

In fact I did put the Docking inside a Grid. The User Control that has  the Docking is inside nested UserControls like this:

The MainWindow has a ControlPresenter that has the COntent set to a User Control call RebateView, this view is instantiated by the MainWindowViewModel.
The RebateView have a ContentControl that is set by RebateViewModel with a UserControl that will have the Docking component that is call ImportarClientesView.

I beleive the problem can cbe that RebateView the Parent of ImportarClientesView does not stretch, or fill the clientArea. I tried to attach the files but
the forum did not allow so I will transcript them here.

Thank yoy very much:

MainWindow

<Window x:Class="Rebate.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:local="clr-namespace:Rebate"
                xmlns:ml="clr-namespace:Rebate.Infrastructure;assembly=Rebate.Infrastructure"
                Title="MainWindow" MinHeight="680" MinWidth="850">
    <Window.Resources>
        <x:StaticExtension Member="ml:ModelLocator.Instance" x:Key="ModelLocator"/>
    </Window.Resources>
    <Grid>
        <StackPanel Orientation="Vertical" Margin="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Border HorizontalAlignment="Stretch" Margin="2" Padding="5" Style="{StaticResource PanelDefault}">
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Padding="5" 
                           Text="Sistema de Rebate" Style="{StaticResource TitleText}"/>
            </Border>
            <ContentControl x:Name="ClientArea" Content="{Binding ClientAreaControl}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
        </StackPanel>
    </Grid>
</Window>

RebateView

<UserControl x:Class="Rebate.Views.RebateView"
             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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:local="clr-namespace:Rebate"
             xmlns:viewModel="clr-namespace:Rebate.ViewModels"
             xmlns:conv="clr-namespace:Rebate.Common.Model.ValueConverters"
             xmlns:ml="clr-namespace:Rebate.Infrastructure;assembly=Rebate.Infrastructure"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <x:StaticExtension Member="ml:ModelLocator.Instance" x:Key="ModelLocator"/>
        <conv:VisToBool x:Key="VisibleIfTrue" Inverted="True" Not="False" />
    </UserControl.Resources>
    <Grid>
        <StackPanel Orientation="Vertical" Margin="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            
            <telerik:RadMenu x:Name="rebateMenu" ClickToOpen="True" Margin="2" Padding="5">
                <telerik:RadMenuItem  Header="Receitas">
                    <telerik:RadMenuItem  Header="Importar Clientes" Command="{Binding ImportarClientesCommand}">
                        <telerik:RadMenuItem.Icon>
                            <Image Source="../Images/Menu/Importar.png" />
                        </telerik:RadMenuItem.Icon>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem  Header="Importar Receitas" Command="{Binding ImportarReceitasCommand}">
                        <telerik:RadMenuItem.Icon>
                            <Image Source="../Images/Menu/Importar.png" />
                        </telerik:RadMenuItem.Icon>
                    </telerik:RadMenuItem>
                </telerik:RadMenuItem>
            </telerik:RadMenu>

            <Border BorderBrush="#FFD6D5D5" BorderThickness="1" CornerRadius="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <ContentControl x:Name="RebateClientArea" Content="{Binding RebateClientAreaControl}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
            </Border>
            
        </StackPanel>            
    </Grid>
</UserControl>

ImportarClientesView

<UserControl x:Class="Rebate.Views.ImportarClientesView"
             x:Name="ctlImportarClientes"
             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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:local="clr-namespace:Rebate"
             xmlns:ml="clr-namespace:Rebate.Infrastructure;assembly=Rebate.Infrastructure"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <x:StaticExtension Member="ml:ModelLocator.Instance" x:Key="ModelLocator"/>
    </UserControl.Resources>

    <Grid>

        <telerik:RadDocking   BorderThickness="0" Padding="0">
            <telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup>
                        <telerik:RadDocumentPane Header="Document 1" Title="Document 1" />
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
        </telerik:RadDocking>

    </Grid>

</UserControl>







0
Igor Diamant
Top achievements
Rank 1
answered on 30 Jul 2014, 01:31 PM
The problem is really because the Parent UserControl dos not stretch or fill the area reserved for it. In fact the ContentPresenter that is its parent des not fill the area.

I have set the ContentPresenter or RebateView with a specific Height and the dockin stretched perfectly.  So I have:

1) MainWindow with a ContentPresenter like this:
<ContentControl x:Name="ClientArea" Content="{Binding ClientAreaControl}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />

2) The MainWindow ContentControl is set with RebateView that has a ContentPresenter like this:
<Border BorderBrush="#FFD6D5D5" BorderThickness="1" Margin="2" CornerRadius="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  <ContentControl x:Name="RebateClientArea" Content="{Binding RebateClientAreaControl}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="500" />
</Border>

3) The Docking a in the third level hierarchy ans is set in the RebateView ContentPresenter;

So Maybe the problem begins when the MainWindow ContentPresenter does not fill the window completelly why does this happens?

Thanks
0
Kalin
Telerik team
answered on 01 Aug 2014, 11:56 AM
Hi Igor,

I tried to reproduce the explained scenario and Docking control took all the available space. However I'm glad you have managed to achieve the desired.

If you have any further questions or concerns, please do not hesitate to contact us.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Docking
Asked by
Igor Diamant
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Igor Diamant
Top achievements
Rank 1
Share this question
or