Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit e74d28e

Browse files
committed
Merged PR 1268052: Add tags for samples
1 parent 70cef0c commit e74d28e

File tree

6 files changed

+53
-11
lines changed

6 files changed

+53
-11
lines changed

SampleGallery/Pages/SearchResultsPage.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
<Grid.RowDefinitions>
1313
<RowDefinition Height="auto"/>
1414
<RowDefinition Height="auto"/>
15+
<RowDefinition Height="auto"/>
1516
</Grid.RowDefinitions>
16-
<local:BodyAppList x:Name="MatchingTitleSampleList" Grid.Row="0"/>
17-
<local:BodyAppList x:Name="MatchingTagSampleList" Grid.Row="1" Margin="0,20,0,60"/>
17+
<TextBlock x:Name="HeaderTextBlock" Grid.Row="0" Style="{StaticResource SubheaderTextBlockStyle}" Margin="35,0"/>
18+
<local:BodyAppList x:Name="MatchingTitleSampleList" Grid.Row="1"/>
19+
<local:BodyAppList x:Name="MatchingTagSampleList" Grid.Row="2" Margin="0,20,0,60"/>
1820
</Grid>
1921
</ScrollViewer>
2022
</Page>

SampleGallery/Pages/SearchResultsPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ where sampleDef.DisplayName.IndexOf(searchText, StringComparison.CurrentCultureI
3939
where (sampleDef.Tags != null && sampleDef.Tags.Any(str => str.IndexOf(searchText, StringComparison.CurrentCultureIgnoreCase) >= 0))
4040
select sampleDef;
4141

42+
HeaderTextBlock.Text = "Results for '" + searchText + "':";
4243
MatchingTitleSampleList.SetHeaderText("Matches by Name (" + nameMatches.Count() + ")");
4344
MatchingTagSampleList.SetHeaderText("Matches by Tag (" + tagMatches.Count() + ")");
4445
if (nameMatches.Count() > 0)

SampleGallery/Shared/SampleDefinition.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ where MainPage.RuntimeCapabilities.AllSupportedSdkVersions.Contains(sampleDef.SD
123123
{
124124
// StaticSampleName Class SampleType SampleCategory Effects FastEffects ThumbnailURL StaticSampleDescription SDKVersion Date Added Featured Tags
125125
#if SDKVERSION_10586
126-
new SampleDefinition(PropertySets.StaticSampleName, typeof(PropertySets), SampleType.Reference, SampleCategory.APIReference, false, false, "ms-appx:///Assets/SampleThumbnails/ExpressionsAndPropertySets.PNG", description: PropertySets.StaticSampleDescription),
127-
new SampleDefinition(PointerEnterEffects.StaticSampleName, typeof(PointerEnterEffects), SampleType.EndToEnd, SampleCategory.Material, true, false, "ms-appx:///Assets/SampleThumbnails/PointerEnterExitEffects.PNG", description: PointerEnterEffects.StaticSampleDescription),
126+
new SampleDefinition(PropertySets.StaticSampleName, typeof(PropertySets), SampleType.Reference, SampleCategory.APIReference, false, false, "ms-appx:///Assets/SampleThumbnails/ExpressionsAndPropertySets.PNG", description: PropertySets.StaticSampleDescription, tags: new string[1]{"ExpressionBuilder"}),
127+
new SampleDefinition(PointerEnterEffects.StaticSampleName, typeof(PointerEnterEffects), SampleType.EndToEnd, SampleCategory.Material, true, false, "ms-appx:///Assets/SampleThumbnails/PointerEnterExitEffects.PNG", description: PointerEnterEffects.StaticSampleDescription, tags: new string[1]{"ExpressionBuilder"}),
128128
new SampleDefinition(ParallaxingListItems.StaticSampleName, typeof(ParallaxingListItems), SampleType.EndToEnd, SampleCategory.Depth, false, false, "ms-appx:///Assets/SampleThumbnails/ParallaxingListviewItem.PNG", description: ParallaxingListItems.StaticSampleDescription),
129-
new SampleDefinition(Z_OrderScrolling.StaticSampleName, typeof(Z_OrderScrolling), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/Z-OrderScrolling.PNG", description: Z_OrderScrolling.StaticSampleDescription),
129+
new SampleDefinition(Z_OrderScrolling.StaticSampleName, typeof(Z_OrderScrolling), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/Z-OrderScrolling.PNG", description: Z_OrderScrolling.StaticSampleDescription, tags: new string[2]{"ExpressionBuilder", "ZOrder"}),
130130
new SampleDefinition(BasicXamlInterop.StaticSampleName, typeof(BasicXamlInterop), SampleType.Reference, SampleCategory.APIReference, false, false, "ms-appx:///Assets/SampleThumbnails/BasicXAMLInterop.PNG", description: BasicXamlInterop.StaticSampleDescription),
131131
new SampleDefinition(ZoomWithPerspective.StaticSampleName, typeof(ZoomWithPerspective), SampleType.EndToEnd, SampleCategory.Depth, false, false, "ms-appx:///Assets/SampleThumbnails/ZoomWithPerspective.PNG", description: ZoomWithPerspective.StaticSampleDescription),
132132
new SampleDefinition(BasicLayoutAndTransforms.StaticSampleName, typeof(BasicLayoutAndTransforms), SampleType.Reference, SampleCategory.APIReference, false, false, "ms-appx:///Assets/SampleThumbnails/BasicLayoutAndTransitions.PNG", description: BasicLayoutAndTransforms.StaticSampleDescription),
133133
new SampleDefinition(Perspective.StaticSampleName, typeof(Perspective), SampleType.Reference, SampleCategory.APIReference, false, false, "ms-appx:///Assets/SampleThumbnails/Perspective.png", description: Perspective.StaticSampleDescription),
134134
new SampleDefinition(ColorBloomTransition.StaticSampleName, typeof(ColorBloomTransition), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/ColorBloom.jpg", description: ColorBloomTransition.StaticSampleDescription),
135135
new SampleDefinition(ColorSlideTransition.StaticSampleName, typeof(ColorSlideTransition), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/ColorSlide.png", description: ColorSlideTransition.StaticSampleDescription),
136136
new SampleDefinition(FlipToReveal.StaticSampleName, typeof(FlipToReveal), SampleType.EndToEnd, SampleCategory.Depth, false, false, "ms-appx:///Assets/SampleThumbnails/FlipToReveal.png", description: FlipToReveal.StaticSampleDescription),
137-
new SampleDefinition(ConnectedAnimationShell.StaticSampleName, typeof(ConnectedAnimationShell), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/ContinuityAnimations.jpg", description: ConnectedAnimationShell.StaticSampleDescription, featured: true),
137+
new SampleDefinition(ConnectedAnimationShell.StaticSampleName, typeof(ConnectedAnimationShell), SampleType.EndToEnd, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/ContinuityAnimations.jpg", description: ConnectedAnimationShell.StaticSampleDescription, featured: true, tags: new string[1]{"ExpressionBuilder"}),
138138
#endif
139139

140140
#if SDKVERSION_14393
@@ -148,7 +148,7 @@ where MainPage.RuntimeCapabilities.AllSupportedSdkVersions.Contains(sampleDef.SD
148148
new SampleDefinition(ForegroundFocusEffects.StaticSampleName, typeof(ForegroundFocusEffects), SampleType.EndToEnd, SampleCategory.Depth, true, true, "ms-appx:///Assets/SampleThumbnails/ForegroundFocusEffects.PNG", description: ForegroundFocusEffects.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
149149
new SampleDefinition(PhotoViewer.StaticSampleName, typeof(PhotoViewer), SampleType.EndToEnd, SampleCategory.Motion, true, false, "ms-appx:///Assets/SampleThumbnails/PhotoPopupViewer.PNG", description: PhotoViewer.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
150150
new SampleDefinition(ThumbnailLighting.StaticSampleName, typeof(ThumbnailLighting), SampleType.EndToEnd, SampleCategory.Light, true, true, "ms-appx:///Assets/SampleThumbnails/ThumbnailLighting.jpg", description: ThumbnailLighting.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
151-
new SampleDefinition(Curtain.StaticSampleName, typeof(Curtain), SampleType.Reference, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/Curtain.PNG", description: Curtain.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
151+
new SampleDefinition(Curtain.StaticSampleName, typeof(Curtain), SampleType.Reference, SampleCategory.Motion, false, false, "ms-appx:///Assets/SampleThumbnails/Curtain.PNG", description: Curtain.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393, tags: new string[1]{"ExpressionBuilder"}),
152152
new SampleDefinition(PullToAnimate.StaticSampleName, typeof(PullToAnimate), SampleType.EndToEnd, SampleCategory.Depth, true, true, "ms-appx:///Assets/SampleThumbnails/PullToAnimate.jpg", description: PullToAnimate.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393, featured: true),
153153
new SampleDefinition(NowPlaying.StaticSampleName, typeof(NowPlaying), SampleType.EndToEnd, SampleCategory.APIReference, true, true, "ms-appx:///Assets/SampleThumbnails/NowPlaying.PNG", description: NowPlaying.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
154154
new SampleDefinition(ShadowPlayground.StaticSampleName, typeof(ShadowPlayground), SampleType.Reference, SampleCategory.APIReference, true, true, "ms-appx:///Assets/SampleThumbnails/ShadowPlayground.jpg", description: ShadowPlayground.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._14393),
@@ -163,7 +163,7 @@ where MainPage.RuntimeCapabilities.AllSupportedSdkVersions.Contains(sampleDef.SD
163163
#endif
164164

165165
#if SDKVERSION_15063
166-
new SampleDefinition(Interactions3D.StaticSampleName, typeof(Interactions3D), SampleType.EndToEnd, SampleCategory.Depth, false, false, "ms-appx:///Assets/SampleThumbnails/Interaction3D.PNG", description: Interactions3D.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._15063, featured: true),
166+
new SampleDefinition(Interactions3D.StaticSampleName, typeof(Interactions3D), SampleType.EndToEnd, SampleCategory.Depth, false, false, "ms-appx:///Assets/SampleThumbnails/Interaction3D.PNG", description: Interactions3D.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._15063, featured: true, tags: new string[2]{"3d", "InteractionTracker"}),
167167
new SampleDefinition(BorderPlayground.StaticSampleName, typeof(BorderPlayground), SampleType.Reference, SampleCategory.APIReference, false, true, "ms-appx:///Assets/SampleThumbnails/BorderEffects.PNG", description: BorderPlayground.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._15063, dateAdded: new DateTime(2017,02,08)),
168168
new SampleDefinition(CompCapabilities.StaticSampleName, typeof(CompCapabilities), SampleType.Reference, SampleCategory.Scale, false, false, "ms-appx:///Assets/SampleThumbnails/CompositionCapabilities.PNG", description: CompCapabilities.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._15063, dateAdded: new DateTime(2017,02,08), featured: true),
169169
new SampleDefinition(TransparentWindow.StaticSampleName, typeof(TransparentWindow), SampleType.EndToEnd, SampleCategory.APIReference, true, true, "ms-appx:///Assets/SampleThumbnails/TransparentWindow.PNG", description: TransparentWindow.StaticSampleDescription, sdkVersion: RuntimeSupportedSDKs.SDKVERSION._15063, dateAdded: new DateTime(2017,02,08), featured: true),

SampleGallery/Shared/SampleHost.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
x:Class="CompositionSampleGallery.SampleHost"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:CompositionSampleGallery"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
76
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
87
mc:Ignorable="d"
@@ -59,8 +58,9 @@
5958
x:Name="SampleCode"
6059
x:FieldModifier="public"
6160
Content="Click here to see the sample code on GitHub" />
61+
<TextBlock x:Name="SampleTagsTextBlock" TextWrapping="WrapWholeWords" x:FieldModifier="public" Visibility="Collapsed"/>
6262
</StackPanel>
6363

64-
<Frame x:Name="ContentFrame" x:FieldModifier="Public" Grid.Row="1" Grid.ColumnSpan="2"/>
64+
<Frame x:Name="ContentFrame" x:FieldModifier="Public" Grid.Row="1" Grid.ColumnSpan="2" />
6565
</Grid>
6666
</Page>

SampleGallery/Shared/SampleHost.xaml.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@
1212
//
1313
//*********************************************************
1414

15+
using System;
1516
using Windows.UI.Xaml.Controls;
17+
using Windows.UI.Xaml.Documents;
1618
using Windows.UI.Xaml.Navigation;
1719

1820
namespace CompositionSampleGallery
1921
{
2022
public sealed partial class SampleHost : Page
2123
{
24+
private SampleDefinition _sampleDefinition;
25+
26+
public SampleDefinition SampleDefinition
27+
{
28+
get { return _sampleDefinition; }
29+
set { _sampleDefinition = value; }
30+
}
31+
2232
public SampleHost()
2333
{
2434
this.InitializeComponent();
@@ -29,7 +39,20 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
2939
base.OnNavigatedTo(e);
3040

3141
SampleDefinition definition = (SampleDefinition)e.Parameter;
42+
SampleDefinition = definition;
3243
ContentFrame.Navigate(definition.Type, this);
3344
}
45+
46+
public void TagHyperlink_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
47+
{
48+
var inline = ((Hyperlink)sender).Inlines[0];
49+
var run = (Run)inline;
50+
var searchString = run.Text;
51+
52+
if (!String.IsNullOrEmpty(searchString))
53+
{
54+
MainNavigationViewModel.ShowSearchResults(searchString);
55+
}
56+
}
3457
}
3558
}

SampleGallery/Shared/SamplePage.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using Windows.UI.Xaml.Controls;
17+
using Windows.UI.Xaml.Documents;
1718
using Windows.UI.Xaml.Navigation;
1819

1920
namespace CompositionSampleGallery
@@ -33,9 +34,24 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
3334
host.SampleDescription.Text = SampleDescription;
3435
host.SampleName.Text = SampleName;
3536
host.SampleCode.NavigateUri = new Uri(SampleCodeUri);
37+
38+
// Show sample tags if any exist
39+
if(host.SampleDefinition.Tags != null)
40+
{
41+
host.SampleTagsTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
42+
host.SampleTagsTextBlock.Inlines.Add(new Run() { Text = "Tags: " });
43+
foreach (string t in host.SampleDefinition.Tags)
44+
{
45+
var hyperlink = new Hyperlink();
46+
hyperlink.Click += host.TagHyperlink_Click;
47+
hyperlink.Inlines.Add(new Run() { Text = t });
48+
host.SampleTagsTextBlock.Inlines.Add(hyperlink);
49+
host.SampleTagsTextBlock.Inlines.Add(new Run() { Text = " " });
50+
}
51+
}
3652
}
3753
}
38-
54+
3955
public virtual void OnCapabiliesChanged(bool areEffectSupported, bool areEffectsFast)
4056
{
4157

0 commit comments

Comments
 (0)