csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
5.3 KiB
124 lines
5.3 KiB
<UserControl xmlns="https://github.com/avaloniaui">
|
|
<DockPanel>
|
|
<TextBlock
|
|
DockPanel.Dock="Top"
|
|
Classes="h1"
|
|
Text="TabControl"
|
|
Margin="4">
|
|
</TextBlock>
|
|
<TextBlock
|
|
DockPanel.Dock="Top"
|
|
Classes="h2"
|
|
Text="A tab control that displays a tab strip along with the content of the selected tab"
|
|
Margin="4">
|
|
</TextBlock>
|
|
<Grid
|
|
ColumnDefinitions="*,*"
|
|
RowDefinitions="*,100">
|
|
<DockPanel
|
|
Grid.Column="0"
|
|
Margin="4">
|
|
<TextBlock
|
|
DockPanel.Dock="Top"
|
|
Classes="h1"
|
|
Text="From Inline TabItems">
|
|
</TextBlock>
|
|
<TabControl
|
|
Margin="0 16"
|
|
TabStripPlacement="{Binding TabPlacement}">
|
|
<TabItem>
|
|
<TabItem.Header>
|
|
<TextBlock
|
|
Text="Arch"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Margin="8">
|
|
</TextBlock>
|
|
</TabItem.Header>
|
|
<StackPanel Orientation="Vertical" Spacing="8">
|
|
<TextBlock>This is the first page in the TabControl.</TextBlock>
|
|
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg" Width="300"/>
|
|
</StackPanel>
|
|
</TabItem>
|
|
<TabItem>
|
|
<TabItem.Header>
|
|
<TextBlock
|
|
Text="Leaf"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Margin="8">
|
|
</TextBlock>
|
|
</TabItem.Header>
|
|
<StackPanel Orientation="Vertical" Spacing="8">
|
|
<TextBlock>This is the second page in the TabControl.</TextBlock>
|
|
<Image Source="resm:ControlCatalog.Assets.maple-leaf-888807_640.jpg" Width="300"/>
|
|
</StackPanel>
|
|
</TabItem>
|
|
<TabItem IsEnabled="False">
|
|
<TabItem.Header>
|
|
<TextBlock
|
|
Text="Disabled"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Margin="8">
|
|
</TextBlock>
|
|
</TabItem.Header>
|
|
<TextBlock>You should not see this.</TextBlock>
|
|
</TabItem>
|
|
</TabControl>
|
|
</DockPanel>
|
|
<DockPanel
|
|
Grid.Column="1"
|
|
Margin="4">
|
|
<TextBlock
|
|
DockPanel.Dock="Top"
|
|
Classes="h1"
|
|
Text="From DataTemplate">
|
|
</TextBlock>
|
|
<TabControl
|
|
Items="{Binding Tabs}"
|
|
Margin="0 16"
|
|
TabStripPlacement="{Binding TabPlacement}">
|
|
<TabControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
Text="{Binding Header}"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Margin="8">
|
|
</TextBlock>
|
|
</DataTemplate>
|
|
</TabControl.ItemTemplate>
|
|
<TabControl.ContentTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Vertical" Spacing="8">
|
|
<TextBlock Text="{Binding Text}"/>
|
|
<Image Source="{Binding Image}" Width="300"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</TabControl.ContentTemplate>
|
|
<TabControl.Styles>
|
|
<Style Selector="TabItem">
|
|
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
|
|
</Style>
|
|
</TabControl.Styles>
|
|
</TabControl>
|
|
</DockPanel>
|
|
<StackPanel
|
|
Grid.Row="1"
|
|
Grid.ColumnSpan="2"
|
|
Orientation="Horizontal"
|
|
Spacing="8"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center">
|
|
<TextBlock VerticalAlignment="Center">Tab Placement:</TextBlock>
|
|
<DropDown SelectedIndex="{Binding TabPlacement, Mode=TwoWay}">
|
|
<DropDownItem>Left</DropDownItem>
|
|
<DropDownItem>Bottom</DropDownItem>
|
|
<DropDownItem>Right</DropDownItem>
|
|
<DropDownItem>Top</DropDownItem>
|
|
</DropDown>
|
|
</StackPanel>
|
|
</Grid>
|
|
</DockPanel>
|
|
</UserControl>
|
|
|