Skip to content

Commit

Permalink
nit: merge two StackPanels (#1421)
Browse files Browse the repository at this point in the history
## Description
nit:  merge two StackPanels

## Motivation and Context
No big deal, just a nit.
  • Loading branch information
Jay-o-Way committed Jan 16, 2024
1 parent b5f81eb commit 91c0044
Showing 1 changed file with 46 additions and 25 deletions.
71 changes: 46 additions & 25 deletions WinUIGallery/ControlPages/SemanticZoomPage.xaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,81 @@
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="AppUIBasics.ControlPages.SemanticZoomPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppUIBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:AppUIBasics.Data"
xmlns:local="using:AppUIBasics"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wuxdata="using:Microsoft.UI.Xaml.Data"
mc:Ignorable="d">
<Page.Resources>
<CollectionViewSource x:Name="cvsGroups" Source="{x:Bind Groups}" IsSourceGrouped="True" ItemsPath="Items"
d:Source="{Binding Groups, Source={d:DesignData Source=/DataModel/ControlInfoData.json, Type=data:ControlInfoDataSource}}"/>
<CollectionViewSource
x:Name="cvsGroups"
d:Source="{Binding Groups, Source={d:DesignData Source=/DataModel/ControlInfoData.json, Type=data:ControlInfoDataSource}}"
IsSourceGrouped="True"
ItemsPath="Items"
Source="{x:Bind Groups}" />

<DataTemplate x:Key="ZoomedInTemplate" x:DataType="data:ControlInfoDataItem">
<StackPanel Orientation="Horizontal" MinWidth="200" Margin="12,6,12,6">
<StackPanel Margin="20,0,0,0">
<TextBlock Text="{x:Bind Title}" Style="{StaticResource BaseTextBlockStyle}"/>
<TextBlock Text="{x:Bind Subtitle}" TextWrapping="Wrap" HorizontalAlignment="Left" Width="300" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
<StackPanel MinWidth="200" Margin="12,6,12,6">
<TextBlock Style="{StaticResource BaseTextBlockStyle}" Text="{x:Bind Title}" />
<TextBlock
Width="300"
HorizontalAlignment="Left"
Style="{StaticResource BodyTextBlockStyle}"
Text="{x:Bind Subtitle}"
TextWrapping="Wrap" />
</StackPanel>
</DataTemplate>

<DataTemplate x:Key="ZoomedInGroupHeaderTemplate" x:DataType="data:ControlInfoDataGroup">
<TextBlock Text="{x:Bind Title}" Foreground="{ThemeResource ApplicationForegroundThemeBrush}" Style="{StaticResource SubtitleTextBlockStyle}"/>
<TextBlock
Foreground="{ThemeResource ApplicationForegroundThemeBrush}"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind Title}" />
</DataTemplate>

<DataTemplate x:Key="ZoomedOutTemplate" x:DataType="wuxdata:ICollectionViewGroup">
<TextBlock Text="{x:Bind ((data:ControlInfoDataGroup)Group).Title}" Style="{StaticResource SubtitleTextBlockStyle}" TextWrapping="Wrap"/>
<TextBlock
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind ((data:ControlInfoDataGroup)Group).Title}"
TextWrapping="Wrap" />
</DataTemplate>
</Page.Resources>

<StackPanel>
<local:ControlExample HeaderText="A simple SemanticZoom" x:Name="Example1">
<local:ControlExample x:Name="Example1" HeaderText="A simple SemanticZoom">
<SemanticZoom x:Name="Control1" Height="500">
<SemanticZoom.ZoomedInView>
<GridView ItemsSource="{x:Bind cvsGroups.View}" ScrollViewer.IsHorizontalScrollChainingEnabled="False" SelectionMode="None" GotFocus="List_GotFocus"
ItemTemplate="{StaticResource ZoomedInTemplate}">
<GridView
GotFocus="List_GotFocus"
ItemTemplate="{StaticResource ZoomedInTemplate}"
ItemsSource="{x:Bind cvsGroups.View}"
ScrollViewer.IsHorizontalScrollChainingEnabled="False"
SelectionMode="None">
<GridView.GroupStyle>
<GroupStyle HeaderTemplate="{StaticResource ZoomedInGroupHeaderTemplate}" />
</GridView.GroupStyle>
</GridView>
</SemanticZoom.ZoomedInView>

<SemanticZoom.ZoomedOutView>
<ListView ItemsSource="{x:Bind cvsGroups.View.CollectionGroups}" SelectionMode="None" ItemTemplate="{StaticResource ZoomedOutTemplate}" GotFocus="List_GotFocus" />
<ListView
GotFocus="List_GotFocus"
ItemTemplate="{StaticResource ZoomedOutTemplate}"
ItemsSource="{x:Bind cvsGroups.View.CollectionGroups}"
SelectionMode="None" />
</SemanticZoom.ZoomedOutView>
</SemanticZoom>
<local:ControlExample.Xaml>
Expand Down

0 comments on commit 91c0044

Please sign in to comment.