Wpf 如何在选项卡控件项中拉伸用户控件

Wpf 如何在选项卡控件项中拉伸用户控件,wpf,user-controls,tabcontrol,caliburn.micro,stretch,Wpf,User Controls,Tabcontrol,Caliburn.micro,Stretch,您好,我尝试解决如何将选项卡控件中活动的用户控件宽度/高度拉伸到选项卡控件宽度/高度 我使用caliburn micro 我创建了一些用户控件。这是: <UserControl x:Class="Spirit.Views.TabChatView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microso

您好,我尝试解决如何将选项卡控件中活动的用户控件宽度/高度拉伸到选项卡控件宽度/高度

我使用caliburn micro

我创建了一些用户控件。这是:

<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>
[…]
此用户控件在shell中处于活动状态,shell声明在此处

<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>

结果如果某个用户控件在此shell中处于活动状态,您可以在此图像上看到:


我希望在最大选项卡控件上使用/height扩展用户控件。

删除用户控件定义中的height=“545”Width=“680”

John,StackOverflow就像一个游戏。虽然人们回答问题是为了分享知识,但正是积分制让它变得有趣。因此,如果你想让人们尝试回答你的所有问题,你需要将解决问题的问题标记为答案,并给他们打分。