0

Hi I try solve how stretch user control width / height which is active in tab control to tab control width / height.

I use caliburn micro.

I create some user control. Here is it:

<UserControl x:Class="Spirit.Views.TabChatView"
             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:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" 
             xmlns:Controls="clr-namespace:Spirit.Controls" mc:Ignorable="d" 
             Name="ChatWindow"
             Background="{StaticResource LightGrayBackground}"
             Height="545" Width="680">[...]</UserControl>

This user control is active in shell, shell declaration is here.

<Window x:Class="Spirit.Views.ChatShellView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" 
        Title="ChatShellView" Height="300" Width="300">
    <DockPanel>
        <Button x:Name="OpenTab"
                Content="Open Tab" 
                DockPanel.Dock="Top" />
        <TabControl x:Name="Items">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding DisplayName}" />
                        <Button Content="X"
                                cal:Message.Attach="CloseItem($dataContext)" />
                    </StackPanel>
                </DataTemplate>
            </TabControl.ItemTemplate>
        </TabControl>
    </DockPanel>
</Window>

Result if some user constrol is active in this shell you can see on this image:

enter image description here

I would like stretch user control on maximum tab control witdh / height.

  • John, StackOverflow is like a game. Although people answer questions to share knowledge, its the points system which makes it interesting. So if you want people to attempt to answer all your questions you need to mark as answers the ones which solve your problem and give them the points. – NVM Feb 07 '11 at 11:09

1 Answers1

2

Remove Height="545" Width="680" in UserControl definition

NVM
  • 5,442
  • 4
  • 41
  • 61