File tree Expand file tree Collapse file tree 9 files changed +13
-7
lines changed Expand file tree Collapse file tree 9 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ using CommunityToolkit . App . Shared . Helpers ;
6
+
5
7
namespace CommunityToolkit . App . Shared . Converters ;
6
8
7
9
public class StringToUriConverter : IValueConverter
8
10
{
9
11
public object Convert ( object value , Type targetType , object parameter , string language )
10
12
{
11
- return new Uri ( "ms-appx:///SourceAssets/" + ( string ) value ) ;
13
+ return new Uri ( IconHelper . GetIconPath ( ( string ) value ) ) ;
12
14
}
13
15
14
16
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;
8
8
9
9
public static class IconHelper
10
10
{
11
+ internal const string SourceAssetsPrefix = "ms-appx:///SourceAssets/" ;
12
+
11
13
public static IconElement ? GetCategoryIcon ( ToolkitSampleCategory category )
12
14
{
13
15
IconElement ? iconElement = null ;
@@ -22,4 +24,9 @@ public static class IconHelper
22
24
}
23
25
return iconElement ;
24
26
}
27
+
28
+ public static string GetIconPath ( string IconPath )
29
+ {
30
+ return SourceAssetsPrefix + IconPath ;
31
+ }
25
32
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public static class NavigationViewHelper
45
45
yield return new MUXC . NavigationViewItem
46
46
{
47
47
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?
49
49
Tag = metadata ,
50
50
} ;
51
51
}
Original file line number Diff line number Diff line change 36
36
</Page .Resources>
37
37
<Grid BorderBrush =" {ThemeResource NavigationViewContentGridBorderBrush}"
38
38
CornerRadius =" 8,0,0,0" >
39
-
40
39
<Grid .RowDefinitions>
41
40
<RowDefinition Height =" Auto" />
42
41
<RowDefinition Height =" *" />
Original file line number Diff line number Diff line change 5
5
using CommunityToolkit . App . Shared . Renderers ;
6
6
using CommunityToolkit . Tooling . SampleGen . Metadata ;
7
7
using CommunityToolkit . App . Shared . Helpers ;
8
- using Microsoft . UI . Xaml . Controls ;
9
8
10
9
namespace CommunityToolkit . App . Shared . Pages ;
11
10
@@ -62,6 +61,7 @@ private void NavView_ItemInvoked(MUXC.NavigationView sender, MUXC.NavigationView
62
61
NavigationFrame . Navigate ( typeof ( SettingsPage ) ) ;
63
62
}
64
63
}
64
+
65
65
// Check if Getting Started page
66
66
else if ( selectedItem . Tag != null && selectedItem . Tag . GetType ( ) == typeof ( string ) )
67
67
{
@@ -116,7 +116,6 @@ private void NavigationFrameOnNavigated(object sender, NavigationEventArgs navig
116
116
}
117
117
else if ( navigationEventArgs . Parameter . GetType ( ) == typeof ( ToolkitFrontMatter ) )
118
118
{
119
-
120
119
EnsureNavigationSelection ( ( ( ToolkitFrontMatter ) navigationEventArgs . Parameter ) . FilePath ) ;
121
120
}
122
121
}
Original file line number Diff line number Diff line change 5
5
xmlns : muxc =" using:Microsoft.UI.Xaml.Controls"
6
6
xmlns : win =" http://schemas.microsoft.com/winfx/2006/xaml/presentation" >
7
7
8
-
9
8
<SolidColorBrush x : Key =" SubtleButtonBackground"
10
9
Color =" {ThemeResource SubtleFillColorTransparent}" />
11
10
<SolidColorBrush x : Key =" SubtleButtonBackgroundPointerOver"
Original file line number Diff line number Diff line change 81
81
</Image >
82
82
</Grid >
83
83
84
-
85
84
<RelativePanel Grid.Column=" 1"
86
85
Grid.ColumnSpan=" 2"
87
86
Margin =" 16,6,0,0" >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ category: Controls
9
9
subcategory : Layout
10
10
discussion-id : 0
11
11
issue-id : 0
12
+ icon : assets/icon.png
12
13
---
13
14
14
15
<!-- 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