Skip to content

Commit 666a83c

Browse files
committed
Improvements and adding categories
1 parent 91f3480 commit 666a83c

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

CommunityToolkit.App.Shared/CommunityToolkit.App.Shared.projitems

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<Compile Include="$(MSBuildThisFileDirectory)Attributes\PackageProjectUrlAttribute.cs" />
2525
<Compile Include="$(MSBuildThisFileDirectory)Behaviors\NavigateToUriAction.cs" />
2626
<Compile Include="$(MSBuildThisFileDirectory)Controls\TitleBar\TitleBar.cs" />
27+
<Compile Include="$(MSBuildThisFileDirectory)Converters\StringToUriConverter.cs" />
2728
<Compile Include="$(MSBuildThisFileDirectory)DocOrSampleTemplateSelector.cs" />
2829
<Compile Include="$(MSBuildThisFileDirectory)Helpers\BackgroundHelper.cs" />
2930
<Compile Include="$(MSBuildThisFileDirectory)Helpers\IconHelper.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace CommunityToolkit.App.Shared.Converters;
6+
7+
public class StringToUriConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, string language)
10+
{
11+
return new Uri("ms-appx:///SourceAssets/" + (string)value);
12+
}
13+
14+
public object ConvertBack(object value, Type targetType, object parameter, string language)
15+
{
16+
return value;
17+
}
18+
}

CommunityToolkit.App.Shared/Styles/ItemTemplates.xaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
xmlns:meta="using:CommunityToolkit.Tooling.SampleGen.Metadata"
66
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
77

8+
<converters:StringToUriConverter x:Name="stringToUriConverter" />
9+
810
<!-- Kind of not supported in Uno (at least directly like this) see https://github.com/unoplatform/uno/issues/7582 (and related root issue)
911
<Style x:Key="IndentedGridViewItemStyle"
1012
BasedOn="{StaticResource DefaultGridViewItemStyle}"
@@ -21,7 +23,9 @@
2123
</Grid.ColumnDefinitions>
2224
<Image Width="16">
2325
<Image.Source>
24-
<BitmapImage UriSource="{Binding Icon}" DecodePixelHeight="16" DecodePixelWidth="16" />
26+
<BitmapImage DecodePixelHeight="16"
27+
DecodePixelWidth="16"
28+
UriSource="{Binding Icon}" />
2529
</Image.Source>
2630
</Image>
2731
<TextBlock Grid.Column="1"
@@ -72,7 +76,7 @@
7276
VerticalAlignment="Center"
7377
Stretch="Uniform">
7478
<Image.Source>
75-
<BitmapImage UriSource="{Binding Icon}" />
79+
<BitmapImage UriSource="{Binding Icon, Converter={StaticResource stringToUriConverter}}" />
7680
</Image.Source>
7781
</Image>
7882
</Grid>

CommunityToolkit.Tooling.SampleGen/ToolkitSampleMetadataGenerator.Documentation.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using CommunityToolkit.Tooling.SampleGen.Metadata;
88
using Microsoft.CodeAnalysis;
99
using Microsoft.CodeAnalysis.Text;
10+
using System.Collections.Immutable;
1011
using System.IO;
1112

1213
namespace CommunityToolkit.Tooling.SampleGen;
@@ -85,8 +86,6 @@ private static void ReportDocumentDiagnostics(SourceProductionContext ctx, Dicti
8586

8687
private ImmutableArray<ToolkitFrontMatter> GatherDocumentFrontMatter(SourceProductionContext ctx, IEnumerable<AdditionalText> data)
8788
{
88-
89-
// System.Diagnostics.Debug
9089
return data.Select(file =>
9190
{
9291
// We have to manually parse the YAML here for now because of

CommunityToolkit.Tooling.SampleGen/ToolkitSampleSubcategory.cs

+15
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,20 @@ public enum ToolkitSampleSubcategory : byte
7171
/// Samples that focus on XAML triggers.
7272
/// </summary>
7373
Triggers,
74+
75+
/// <summary>
76+
/// Samples that focus on data helpers.
77+
/// </summary>
78+
Data,
79+
80+
/// <summary>
81+
/// Samples that focus on system helpers.
82+
/// </summary>
83+
System,
84+
85+
/// <summary>
86+
/// Samples that focus on helpers during development.
87+
/// </summary>
88+
Developer,
7489
}
7590

0 commit comments

Comments
 (0)