Skip to content

Improve TabStrip reference page #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions docs/reference/controls/tabstrip.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,36 @@ import TabStripNavigation from '/img/reference/controls/tabstrip/tabstrip-naviga

Displays a strip of tab headers. You can use this control as a horizontal menu.

The tab strip is comprised `<TabItem>` elements. These are displayed in the sequence that they appear in the XAML.
The `TabStrip` is composed of `TabStripItem` children. `TabStripItem`s are displayed in order of appearance and can be created by either: 1. a collection of `TabStripItem`s or 2. generated by `ItemsSource`.

## Useful Property
Unlike `TabControl`, `TabStrip` is not responsible for presenting the content of the selected tab. Instead, `TabStrip` requires developers to respond to `SelectionChanged` events or `SelectedItem` property changes and then present the desired content with a separate control, such as `ContentControl`. This gives developers full control over the displayed content and enables use cases such as custom view caching.

You will probably use this property most often:

<table><thead><tr><th width="244">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>TabItem.Header</code></td><td>The text for the tab.</td></tr></tbody></table>

## Example
## Example: TabStrip with TabStripItem

```xml
<TabStrip Margin="5">
<TabItem Header="Tab 1"/>
<TabItem Header="Tab 2"/>
<TabItem Header="Tab 3"/>
<TabStripItem>Tab 1</TabStripItem>
<TabStripItem>Tab 2</TabStripItem>
<TabStripItem>Tab 3</TabStripItem>
</TabStrip>
```

It looks like this running on Windows:

<img src={TabStripNavigation} alt="" />

## Example: TabStrip with ItemsSource

```xml
<TabStrip ItemsSource="{Binding MyTabs}" SelectedItem="{Binding MySelectedItem}">
<TabStrip.ItemTemplate>
<DataTemplate x:DataType="vm:MyViewModel">
<TextBlock Text="{Binding Header}"/>
</DataTemplate>
</TabStrip.ItemTemplate>
</TabStrip>
```

## More Information

:::info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@ import TabStripNavigation from '/img/reference/controls/tabstrip/tabstrip-naviga

显示一条选项卡头的条带。您可以将此控件用作水平菜单。

选项卡条由 `<TabItem>` 元素组成。这些元素按它们在 XAML 中出现的顺序显示。

## 有用的属性

您可能最常使用此属性:

<table><thead><tr><th width="244">属性</th><th>描述</th></tr></thead><tbody><tr><td><code>TabItem.Header</code></td><td>选项卡的文本。</td></tr></tbody></table>
选项卡条由 `<TabStripItem>` 元素组成。这些元素按它们在 XAML 中出现的顺序显示。

## 示例

```xml
<TabStrip Margin="5">
<TabItem Header="Tab 1"/>
<TabItem Header="Tab 2"/>
<TabItem Header="Tab 3"/>
<TabStripItem>Tab 1</TabStripItem>
<TabStripItem>Tab 2</TabStripItem>
<TabStripItem>Tab 3</TabStripItem>
</TabStrip>
```

Expand Down
Loading