forked from microsoft/WinUI-Gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIconsPage.xaml
More file actions
245 lines (232 loc) · 12.9 KB
/
IconsPage.xaml
File metadata and controls
245 lines (232 loc) · 12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!--
//*********************************************************
//
// 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.IconsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:AppUIBasics.Controls"
xmlns:controls1="using:WinUIGallery.DesktopWap.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:AppUIBasics"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
<Page.Resources>
<StaticResource x:Key="GridViewItemBackgroundSelected" ResourceKey="AccentFillColorDefaultBrush" />
<StaticResource x:Key="GridViewItemBackgroundSelectedPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
<StaticResource x:Key="GridViewItemForegroundSelected" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
<Style x:Key="CodeValuePresenterStyle" TargetType="controls:SampleCodePresenter">
<Setter Property="BorderBrush" Value="{ThemeResource ControlStrokeColorSecondaryBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="Padding" Value="24" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource ControlFillColorDefaultBrush}" />
<Setter Property="SampleType" Value="Inline" />
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="0,4,0,16" />
</Style>
<DataTemplate x:Key="IconTemplate">
<ItemContainer
AutomationProperties.Name="{Binding Name}"
ToolTipService.ToolTip="{Binding Name}"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
Width="96"
Height="96"
Margin="4">
<Grid>
<!-- Icon -->
<Viewbox
Grid.Row="1"
Width="28"
Height="28"
Margin="0,0,0,10">
<FontIcon
x:Name="IconGlyph"
Grid.Row="1"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Glyph="{Binding Character}" />
</Viewbox>
<!-- Icon name/descriptor -->
<TextBlock
x:Name="IconName"
Grid.Row="2"
Margin="6,0,6,8"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding Name}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
</Grid>
</ItemContainer>
</DataTemplate>
</Page.Resources>
<Grid HorizontalAlignment="Stretch" RowSpacing="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="With the release of Windows 11, Segoe Fluent Icons is the recommended icon font." />
<toolkit:SettingsExpander
Grid.Row="1"
Header="Instructions on how to use Segoe Fluent Icons"
IsExpanded="False">
<toolkit:SettingsExpander.Items>
<toolkit:SettingsCard Padding="16,8" ContentAlignment="Left">
<RichTextBlock TextWrapping="Wrap">
<Paragraph FontWeight="SemiBold">
How to get the font
</Paragraph>
<Paragraph>
On Windows 11: There's nothing you need to do, the font comes with Windows.<LineBreak />
On Windows 10: Segoe Fluent Icons is not included by default on Windows 10. You can download it <Hyperlink NavigateUri="https://learn.microsoft.com/windows/apps/design/downloads/#fonts">here</Hyperlink> .</Paragraph>
</RichTextBlock>
</toolkit:SettingsCard>
<toolkit:SettingsCard Padding="16,8" ContentAlignment="Left">
<StackPanel Orientation="Vertical" Spacing="8">
<RichTextBlock TextWrapping="Wrap">
<Paragraph FontWeight="SemiBold">
How to use the font
</Paragraph>
<Paragraph>
If you don't specify a FontFamily,
or you specify a FontFamily that is not available on the system at runtime,
the <Hyperlink NavigateUri="https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.fonticon">FontIcon</Hyperlink> falls back to the default font family defined by the SymbolThemeFontFamily resource.
</Paragraph>
<Paragraph>
An icon with a 16-epx font size is the equivalent of a 16x16-epx icon, to make sizing and positioning more predictable.
For optimal appearance, use these specific sizes: 16, 20, 24, 32, 40, 48, and 64. Deviating from these font sizes could lead to less crisp or blurry outcomes.
</Paragraph>
<Paragraph>
All glyphs in Segoe Fluent Icons have the same fixed width with a consistent height and left origin point, so <Hyperlink NavigateUri="https://learn.microsoft.com/windows/apps/design/style/segoe-fluent-icons-font#layering-and-mirroring">layering</Hyperlink> and colorization effects can be achieved by drawing glyphs directly on top of each other.</Paragraph>
</RichTextBlock>
<controls:SampleCodePresenter CodeSourceFile="Icons/FontIconSample2_xaml.txt" SampleType="XAML" />
</StackPanel>
</toolkit:SettingsCard>
</toolkit:SettingsExpander.Items>
</toolkit:SettingsExpander>
<StackPanel
Grid.Row="2"
Margin="0,24,0,0"
Spacing="8">
<TextBlock Style="{ThemeResource BodyStrongTextBlockStyle}" Text="Fluent Icons Library" />
<AutoSuggestBox
x:Name="IconsAutoSuggestBox"
MinWidth="304"
MaxWidth="320"
HorizontalAlignment="Left"
PlaceholderText="Search icons"
QueryIcon="Find"
TextChanged="SearchTextBox_TextChanged" />
</StackPanel>
<controls1:SampleThemeListener
Grid.Row="3"
MaxHeight="600"
VerticalAlignment="Top"
IsTabStop="True">
<Grid Style="{ThemeResource GalleryTileGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="296" />
</Grid.ColumnDefinitions>
<ScrollViewer
Padding="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AutomationProperties.Name="Icons">
<ItemsView
x:Name="IconsItemsView"
MinWidth="100"
Margin="0,0,0,36"
HorizontalAlignment="Stretch"
SelectionChanged="IconsItemsView_SelectionChanged"
ItemTemplate="{StaticResource IconTemplate}"
TabFocusNavigation="Once">
<ItemsView.Layout>
<UniformGridLayout Orientation="Horizontal" />
</ItemsView.Layout>
</ItemsView>
</ScrollViewer>
<Grid
Grid.Column="1"
Padding="16"
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1,0,0,0"
DataContext="{x:Bind}">
<StackPanel>
<TextBlock
VerticalAlignment="Center"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{Binding SelectedItem.Name, Mode=OneWay}" />
<FontIcon
Margin="0,12,0,32"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="{x:Bind (x:Double)FontsizeComboBox.SelectedValue, Mode=OneWay}"
Glyph="{Binding SelectedItem.Character, Mode=OneWay}" />
<TextBlock Text="Icon name" />
<controls:SampleCodePresenter Code="{Binding SelectedItem.Name, Mode=OneWay}" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="Unicode point" />
<controls:SampleCodePresenter Code="{Binding SelectedItem.Code, Mode=OneWay}" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="Text glyph" />
<controls:SampleCodePresenter Code="{Binding SelectedItem.TextGlyph, Mode=OneWay}" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="Code glyph" />
<controls:SampleCodePresenter Code="{Binding SelectedItem.CodeGlyph, Mode=OneWay}" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="XAML" />
<controls:SampleCodePresenter x:Name="XAMLCodePresenter" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="C#" />
<controls:SampleCodePresenter x:Name="CSharpCodePresenter" Style="{StaticResource CodeValuePresenterStyle}" />
<StackPanel Orientation="Vertical" Visibility="Collapsed">
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="Color" />
<controls1:InlineColorPicker
x:Name="IconColorPicker"
Grid.Row="1"
Grid.Column="1"
Color="Black" />
<TextBlock
Grid.Row="2"
Padding="0,10,0,0"
VerticalAlignment="Center"
Text="FontSize" />
<Grid
Grid.Row="2"
Grid.Column="1"
Padding="0,10,0,0"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ComboBox
x:Name="FontsizeComboBox"
Width="100"
ItemsSource="{x:Bind FontSizes}"
SelectedIndex="3" />
</Grid>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</controls1:SampleThemeListener>
</Grid>
</Page>