|
<UserControl x:Class="ServiceTreeSample.Views.TabbedDocumentView"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<TabControl ItemsSource="{Binding Documents}">
<TabControl.ItemContainerStyle>
<Style TargetType="TabItem">
<Setter Property="IsSelected" Value="{Binding IsActive}"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Document.Title}"/>
<TextBlock Text="*" Margin="3,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Document.IsModified}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button Command="{Binding CloseCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid Margin="3,0,0,0">
<Ellipse Width="12" Height="12" Fill="DarkRed"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="×" Foreground="White"
Margin="0,-2,0,0"/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Content" Value="{Binding View}"/>
</Style>
</TabControl.ItemContainerStyle>
</TabControl>
</UserControl>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
David is a software developer with an obsession for analysis and proper architecture.