Skip to content
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

Make TabItems as content property of TabView #1845

Merged
merged 1 commit into from Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions dev/TabView/TabView.idl
Expand Up @@ -46,6 +46,7 @@ runtimeclass TabViewTabDragCompletedEventArgs

[WUXC_VERSION_MUXONLY]
[webhosthidden]
[contentproperty("TabItems")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it surprises me that this doesn't come with any generated files changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the way this works is that this attribute gets tacked onto the winmd metadata and the parser can then get this information from the metadata. @danzil might be able to elaborate more.

unsealed runtimeclass TabView : Windows.UI.Xaml.Controls.Control
{
TabView();
Expand Down
117 changes: 57 additions & 60 deletions dev/TabView/TestUI/TabViewPage.xaml
Expand Up @@ -103,66 +103,63 @@
</Grid>
</controls:TabView.TabStripFooter>

<controls:TabView.TabItems>
ranjeshj marked this conversation as resolved.
Show resolved Hide resolved

<controls:TabViewItem x:Name="FirstTab" AutomationProperties.Name="FirstTab" Header="Home" CloseRequested="FirstTab_CloseRequested" ToolTipService.ToolTip="Custom Tooltip">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Home"/>
</controls:TabViewItem.IconSource>

<StackPanel x:Name="FirstTabContent" AutomationProperties.Name="FirstTabContent">
<Button x:Name="FirstTabButton" AutomationProperties.Name="FirstTabButton" Margin="8" FontSize="20">Home Button</Button>
<Button x:Name="TabViewSizingPageButton" AutomationProperties.Name="TabViewSizingPageButton" Margin="8" Click="TabViewSizingPageButton_Click" FontSize="20">TabView Sizing Page</Button>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="SecondTab" Header="SecondTab" IsClosable="True">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Shop"/>
</controls:TabViewItem.IconSource>

<StackPanel Padding="16">
<TextBlock>Shop text</TextBlock>
<Button Content="SecondTabButton" AutomationProperties.Name="SecondTabButton"/>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="LongHeaderTab" AutomationProperties.Name="LongHeaderTab" Header="Long Header No Icon">
<StackPanel Padding="16">
<TextBlock >Emoji text</TextBlock>
<Button Content="Button 3"/>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="NotCloseableTab" AutomationProperties.Name="NotCloseableTab" Header="Video" IsClosable="False">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Video"/>
</controls:TabViewItem.IconSource>

<StackPanel>
<TextBlock Padding="16">This tab can't be closed.</TextBlock>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="DisabledTab" AutomationProperties.Name="DisabledTab" Header="Disabled" IsEnabled="False">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Admin"/>
</controls:TabViewItem.IconSource>

<StackPanel>
<TextBlock Padding="16">This tab can't be selected.</TextBlock>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="LastTab" AutomationProperties.Name="LastTab" Header="Contact">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Contact"/>
</controls:TabViewItem.IconSource>

<TextBlock x:Name="LastTabContent" AutomationProperties.Name="LastTabContent" Padding="16">Contact text</TextBlock>
</controls:TabViewItem>

</controls:TabView.TabItems>
<controls:TabViewItem x:Name="FirstTab" AutomationProperties.Name="FirstTab" Header="Home" CloseRequested="FirstTab_CloseRequested" ToolTipService.ToolTip="Custom Tooltip">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Home"/>
</controls:TabViewItem.IconSource>

<StackPanel x:Name="FirstTabContent" AutomationProperties.Name="FirstTabContent">
<Button x:Name="FirstTabButton" AutomationProperties.Name="FirstTabButton" Margin="8" FontSize="20">Home Button</Button>
<Button x:Name="TabViewSizingPageButton" AutomationProperties.Name="TabViewSizingPageButton" Margin="8" Click="TabViewSizingPageButton_Click" FontSize="20">TabView Sizing Page</Button>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="SecondTab" Header="SecondTab" IsClosable="True">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Shop"/>
</controls:TabViewItem.IconSource>

<StackPanel Padding="16">
<TextBlock>Shop text</TextBlock>
<Button Content="SecondTabButton" AutomationProperties.Name="SecondTabButton"/>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="LongHeaderTab" AutomationProperties.Name="LongHeaderTab" Header="Long Header No Icon">
<StackPanel Padding="16">
<TextBlock >Emoji text</TextBlock>
<Button Content="Button 3"/>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="NotCloseableTab" AutomationProperties.Name="NotCloseableTab" Header="Video" IsClosable="False">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Video"/>
</controls:TabViewItem.IconSource>

<StackPanel>
<TextBlock Padding="16">This tab can't be closed.</TextBlock>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="DisabledTab" AutomationProperties.Name="DisabledTab" Header="Disabled" IsEnabled="False">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Admin"/>
</controls:TabViewItem.IconSource>

<StackPanel>
<TextBlock Padding="16">This tab can't be selected.</TextBlock>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="LastTab" AutomationProperties.Name="LastTab" Header="Contact">
<controls:TabViewItem.IconSource>
<controls:SymbolIconSource Symbol="Contact"/>
</controls:TabViewItem.IconSource>

<TextBlock x:Name="LastTabContent" AutomationProperties.Name="LastTabContent" Padding="16">Contact text</TextBlock>
</controls:TabViewItem>

</controls:TabView>

<Grid Grid.Row="1">
Expand Down