Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iconograpy page tag buttons #1693

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions WinUIGallery/ControlPages/DesignGuidance/IconographyPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:WinUIGallery.Controls"
xmlns:controls1="using:WinUIGallery.DesktopWap.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
Expand All @@ -36,7 +37,7 @@
<Setter Property="SampleType" Value="Inline" />
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="0,4,0,16" />
<Setter Property="Margin" Value="0,4,0,4" />
</Style>

<DataTemplate x:Key="IconTemplate">
Expand Down Expand Up @@ -77,6 +78,9 @@
</Grid>
</ItemContainer>
</DataTemplate>

<converters:EmptyCollectionToObjectConverter x:Key="emptyCollectionToFalseConverter" EmptyValue="False" NotEmptyValue="True" />
<converters:EmptyCollectionToObjectConverter x:Key="emptyCollectionToTrueConverter" EmptyValue="True" NotEmptyValue="False" />
</Page.Resources>

<Grid HorizontalAlignment="Stretch" RowSpacing="8">
Expand Down Expand Up @@ -140,7 +144,7 @@
MinWidth="304"
MaxWidth="320"
HorizontalAlignment="Left"
PlaceholderText="Search icons"
PlaceholderText="Search icons by name, code, or tags.."
QueryIcon="Find"
TextChanged="SearchTextBox_TextChanged" />
</StackPanel>
Expand Down Expand Up @@ -187,15 +191,13 @@
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{Binding SelectedItem.Name, Mode=OneWay}" />
<FontIcon
Margin="0,12,0,32"
Margin="0,12,0,12"
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" />
Expand All @@ -206,6 +208,27 @@
<controls:SampleCodePresenter x:Name="XAMLCodePresenter" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="C#" />
<controls:SampleCodePresenter x:Name="CSharpCodePresenter" Style="{StaticResource CodeValuePresenterStyle}" />
<TextBlock Text="Tags" />
<ItemsView
x:Name="TagsItemsView"
x:Load="{x:Bind SelectedItem.Tags, Mode=OneWay, Converter={StaticResource emptyCollectionToFalseConverter}}"
ItemsSource="{Binding SelectedItem.Tags, Mode=OneWay}"
Margin="0,4,0,4">
<ItemsView.Layout>
<LinedFlowLayout LineSpacing="4" MinItemSpacing="4" />
</ItemsView.Layout>
<ItemsView.ItemTemplate>
<DataTemplate x:DataType="x:String">
<ItemContainer>
<Button Content="{x:Bind Mode=OneWay}" Click="TagButton_Click" />
</ItemContainer>
</DataTemplate>
</ItemsView.ItemTemplate>
</ItemsView>
<TextBlock
x:Name="NoTagsTextBlock"
x:Load="{x:Bind SelectedItem.Tags, Mode=OneWay, Converter={StaticResource emptyCollectionToTrueConverter}}"
Text="No tags" />

<StackPanel Orientation="Vertical" Visibility="Collapsed">
<TextBlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,13 @@ private void IconsItemsView_SelectionChanged(ItemsView sender, ItemsViewSelectio

}
}

private void TagButton_Click(object sender, RoutedEventArgs e)
{
if ((sender as Button).Content is string tag)
{
IconsAutoSuggestBox.Text = tag;
}
}
}
}
9 changes: 7 additions & 2 deletions WinUIGallery/DataModel/IconsData.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
{
"Code": "E700",
"Name": "GlobalNavButton",
"Tags": []
"Tags": [
"menu",
"hamburger"
]
},
{
"Code": "E701",
Expand Down Expand Up @@ -5495,7 +5498,9 @@
{
"Code": "EDE3",
"Name": "ButtonMenu",
"Tags": []
"Tags": [
"hamburger"
]
},
{
"Code": "EDE4",
Expand Down