File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ using CommunityToolkit . App . Shared . Helpers ;
6+
57namespace CommunityToolkit . App . Shared . Converters ;
68
79public class StringToUriConverter : IValueConverter
810{
911 public object Convert ( object value , Type targetType , object parameter , string language )
1012 {
11- return new Uri ( "ms-appx:///SourceAssets/" + ( string ) value ) ;
13+ return new Uri ( IconHelper . GetIconPath ( ( string ) value ) ) ;
1214 }
1315
1416 public object ConvertBack ( object value , Type targetType , object parameter , string language )
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ namespace CommunityToolkit.App.Shared.Helpers;
88
99public static class IconHelper
1010{
11+ internal const string SourceAssetsPrefix = "ms-appx:///SourceAssets/" ;
12+
1113 public static IconElement ? GetCategoryIcon ( ToolkitSampleCategory category )
1214 {
1315 IconElement ? iconElement = null ;
@@ -22,4 +24,9 @@ public static class IconHelper
2224 }
2325 return iconElement ;
2426 }
27+
28+ public static string GetIconPath ( string IconPath )
29+ {
30+ return SourceAssetsPrefix + IconPath ;
31+ }
2532}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public static class NavigationViewHelper
4545 yield return new MUXC . NavigationViewItem
4646 {
4747 Content = metadata . Title ,
48- Icon = new BitmapIcon ( ) { ShowAsMonochrome = false , UriSource = new Uri ( "ms-appx:///SourceAssets/" + metadata . Icon ) } , // TO DO: This is probably a property we need to add to ToolkitFrontMatter?
48+ Icon = new BitmapIcon ( ) { ShowAsMonochrome = false , UriSource = new Uri ( IconHelper . GetIconPath ( metadata . Icon ) ) } , // TO DO: This is probably a property we need to add to ToolkitFrontMatter?
4949 Tag = metadata ,
5050 } ;
5151 }
Original file line number Diff line number Diff line change 3636 </Page .Resources>
3737 <Grid BorderBrush =" {ThemeResource NavigationViewContentGridBorderBrush}"
3838 CornerRadius =" 8,0,0,0" >
39-
4039 <Grid .RowDefinitions>
4140 <RowDefinition Height =" Auto" />
4241 <RowDefinition Height =" *" />
Original file line number Diff line number Diff line change 55using CommunityToolkit . App . Shared . Renderers ;
66using CommunityToolkit . Tooling . SampleGen . Metadata ;
77using CommunityToolkit . App . Shared . Helpers ;
8- using Microsoft . UI . Xaml . Controls ;
98
109namespace CommunityToolkit . App . Shared . Pages ;
1110
@@ -62,6 +61,7 @@ private void NavView_ItemInvoked(MUXC.NavigationView sender, MUXC.NavigationView
6261 NavigationFrame . Navigate ( typeof ( SettingsPage ) ) ;
6362 }
6463 }
64+
6565 // Check if Getting Started page
6666 else if ( selectedItem . Tag != null && selectedItem . Tag . GetType ( ) == typeof ( string ) )
6767 {
@@ -116,7 +116,6 @@ private void NavigationFrameOnNavigated(object sender, NavigationEventArgs navig
116116 }
117117 else if ( navigationEventArgs . Parameter . GetType ( ) == typeof ( ToolkitFrontMatter ) )
118118 {
119-
120119 EnsureNavigationSelection ( ( ( ToolkitFrontMatter ) navigationEventArgs . Parameter ) . FilePath ) ;
121120 }
122121 }
Original file line number Diff line number Diff line change 55 xmlns : muxc =" using:Microsoft.UI.Xaml.Controls"
66 xmlns : win =" http://schemas.microsoft.com/winfx/2006/xaml/presentation" >
77
8-
98 <SolidColorBrush x : Key =" SubtleButtonBackground"
109 Color =" {ThemeResource SubtleFillColorTransparent}" />
1110 <SolidColorBrush x : Key =" SubtleButtonBackgroundPointerOver"
Original file line number Diff line number Diff line change 8181 </Image >
8282 </Grid >
8383
84-
8584 <RelativePanel Grid.Column=" 1"
8685 Grid.ColumnSpan=" 2"
8786 Margin =" 16,6,0,0" >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ category: Controls
99subcategory : Layout
1010discussion-id : 0
1111issue-id : 0
12+ icon : assets/icon.png
1213---
1314
1415<!-- To know about all the available Markdown syntax, Check out https://docs.microsoft.com/contribute/markdown-reference -->
You can’t perform that action at this time.
0 commit comments