how stretch user control in tab control item
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;assembl开发者_JAVA技巧y=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:
I would like stretch user control on maximum tab control witdh / height.
Remove Height="545" Width="680" in UserControl definition
精彩评论