Files
HandyControl/src/Shared/HandyControlDemo_Shared/UserControl/Controls/TabControlDemoCtl.xaml
T
2020-01-05 23:34:39 +08:00

87 lines
5.7 KiB
XML

<UserControl x:Class="HandyControlDemo.UserControl.TabControlDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="{DynamicResource RegionBrush}"
DataContext="{Binding TabControlDemo,Source={StaticResource Locator}}"
xmlns:hc="https://handyorg.github.io/handycontrol">
<hc:TransitioningContentControl>
<hc:ScrollViewer HorizontalScrollBarVisibility="Auto">
<hc:Interaction.Triggers>
<hc:RoutedEventTrigger RoutedEvent="hc:TabItem.Closing">
<hc:EventToCommand Command="{Binding ClosingCmd}" PassEventArgsToCommand="True" />
</hc:RoutedEventTrigger>
<hc:RoutedEventTrigger RoutedEvent="hc:TabItem.Closed">
<hc:EventToCommand Command="{Binding ClosedCmd}" PassEventArgsToCommand="True" />
</hc:RoutedEventTrigger>
</hc:Interaction.Triggers>
<StackPanel>
<Label Style="{StaticResource LabelPrimary}" Content="Default" Margin="32,32,0,0" HorizontalAlignment="Left"/>
<hc:TabControl ShowOverflowButton="False" ShowScrollButton="True" Margin="32,16,32,0" Width="800" Height="300" IsScrollable="True">
<hc:TabItem Header="TabItem1" IsSelected="True">
<hc:SimplePanel Background="{DynamicResource RegionBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem2">
<hc:SimplePanel Background="{DynamicResource DarkDangerBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem3">
<hc:SimplePanel Background="{DynamicResource PrimaryBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem4">
<hc:SimplePanel Background="{DynamicResource DarkInfoBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem5">
<hc:SimplePanel Background="{DynamicResource DarkSuccessBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem6">
<hc:SimplePanel Background="{DynamicResource DarkWarningBrush}"/>
</hc:TabItem>
<hc:TabItem Header="TabItem7">
<hc:SimplePanel Background="{DynamicResource DarkAccentBrush}"/>
</hc:TabItem>
</hc:TabControl>
<StackPanel Orientation="Horizontal" Margin="32,32,32,16">
<Label Style="{StaticResource LabelPrimary}" Margin="0" Content="IsTabFillEnabled = True"/>
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="ShowCloseButton = True"/>
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsDraggable = True"/>
<Label Style="{StaticResource LabelPrimary}" Margin="16,0,0,0" Content="IsAnimationEnabled = True"/>
</StackPanel>
<hc:TabControl x:Name="TabControlDemo" IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" IsTabFillEnabled="True" Margin="32,0,32,32" Width="800" Height="300">
<hc:TabItem Header="TabItem1" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}">
<hc:SimplePanel Background="{DynamicResource RegionBrush}"/>
</hc:TabItem>
<hc:TabItem IsSelected="True" Header="TabItem2" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource CalendarGeometry}">
<hc:SimplePanel Tag="123" Background="#FFE8563F"/>
</hc:TabItem>
<hc:TabItem Header="TabItem3" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource WindowsGeometry}">
<hc:SimplePanel Background="#FF3F4EE8"/>
</hc:TabItem>
<hc:TabItem Header="TabItem4" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ClockGeometry}">
<hc:SimplePanel Background="#FFE83F6D"/>
</hc:TabItem>
<hc:TabItem Header="TabItem5">
<hc:SimplePanel Background="#FFB23FE8"/>
</hc:TabItem>
<hc:TabItem Header="TabItem6">
<hc:SimplePanel Background="#FF3FE8E8"/>
</hc:TabItem>
<hc:TabItem Header="TabItem7">
<hc:SimplePanel Background="#FFE8E03F"/>
</hc:TabItem>
</hc:TabControl>
<hc:TabControl IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" Width="800" Height="300">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Header}"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<hc:SimplePanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding BackgroundToken,Converter={StaticResource String2BrushConverter}}"/>
</DataTemplate>
</TabControl.ContentTemplate>
</hc:TabControl>
</StackPanel>
</hc:ScrollViewer>
</hc:TransitioningContentControl>
</UserControl>