Skip to content

Commit

Permalink
[ WPF Gallery ] Added ControlsInfoData.json for providing support for…
Browse files Browse the repository at this point in the history
… navigation (#625)

* Added ControlsInfoData.json

* Fixing navigation for UserDashboard Page

* Fixed file path in VideoViewerDemo (#518)

* Fixed file path in VideoViewerDemo

* Copying media to output directory and then referencing it

* Update VideoViewerDemo.csproj

---------

Co-authored-by: Dipesh Kumar <[email protected]>

* Fixed invalid day and month in StickyNotesDemo proj (#522)

* Removed extra imports from the cs files (#624)

* Added ControlsInfoData.json

* Fixing navigation for UserDashboard Page

* Fixing review comments

---------

Co-authored-by: Anjali <[email protected]>
  • Loading branch information
dipeshmsft and anjali-wpf authored Aug 28, 2024
1 parent bd01d0e commit c51692d
Show file tree
Hide file tree
Showing 35 changed files with 548 additions and 773 deletions.
1 change: 0 additions & 1 deletion Sample Applications/WPFGallery/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using WPFGallery.Navigation;
using WPFGallery.ViewModels;
using WPFGallery.Views;
using WPFGallery.Views.Samples;
using WPFGallery.ViewModels.Samples;

namespace WPFGallery;
Expand Down
10 changes: 5 additions & 5 deletions Sample Applications/WPFGallery/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
PreviewKeyDown="ControlsList_PreviewKeyDown"
PreviewMouseLeftButtonUp="ControlsList_PreviewMouseLeftButtonUp">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<HierarchicalDataTemplate ItemsSource="{Binding Items}">
<Grid MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
Expand All @@ -230,16 +230,16 @@
<TextBlock
MaxWidth="16"
VerticalAlignment="Center"
AutomationProperties.Name="{Binding Name, StringFormat='{}{0} Page'}"
AutomationProperties.Name="{Binding Title, StringFormat='{}{0} Page'}"
Focusable="False"
FontFamily="Segoe Fluent Icons"
FontSize="16"
Text="{Binding Icon}"
Visibility="{Binding Icon, Converter={StaticResource EmptyToVisibilityConverter}}" />
Text="{Binding IconGlyph}"
Visibility="{Binding IconGlyph, Converter={StaticResource EmptyToVisibilityConverter}}" />
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
Text="{Binding Name}" />
Text="{Binding Title}" />
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
Expand Down
7 changes: 4 additions & 3 deletions Sample Applications/WPFGallery/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows.Shell;
using WPFGallery.Navigation;
using WPFGallery.ViewModels;
using WPFGallery.Models;
using WPFGallery.Views;

namespace WPFGallery;
Expand Down Expand Up @@ -82,7 +83,7 @@ private void MainWindow_StateChanged(object sender, EventArgs e)

private void ControlsList_SelectedItemChanged()
{
if (ControlsList.SelectedItem is NavigationItem navItem)
if (ControlsList.SelectedItem is ControlInfoDataItem navItem)
{
_navigationService.Navigate(navItem.PageType);
var tvi = ControlsList.ItemContainerGenerator.ContainerFromItem(navItem) as TreeViewItem;
Expand Down Expand Up @@ -167,13 +168,13 @@ private void CloseWindow(object sender, RoutedEventArgs e)

private void OnNavigating(object? sender, NavigatingEventArgs e)
{
List<NavigationItem> list = ViewModel.GetNavigationItemHierarchyFromPageType(e.PageType);
List<ControlInfoDataItem> list = ViewModel.GetNavigationItemHierarchyFromPageType(e.PageType);

if (list.Count > 0)
{
TreeViewItem selectedTreeViewItem = null;
ItemsControl itemsControl = ControlsList;
foreach(NavigationItem item in list)
foreach(ControlInfoDataItem item in list)
{
var tvi = itemsControl.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
if(tvi != null)
Expand Down
287 changes: 287 additions & 0 deletions Sample Applications/WPFGallery/Models/ControlsInfoData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
[
{
"UniqueId": "Home",
"Title": "Home",
"PageName": "DashboardPage",
"IconGlyph": "\uE80F"
},
{
"UniqueId": "Design Guidance",
"Title": "Design Guidance",
"PageName": "DesignGuidancePage",
"IconGlyph": "\uEB3C",
"IsGroup": true,
"Items": [
{
"UniqueId": "Colors",
"Title": "Colors",
"PageName": "ColorsPage",
"IconGlyph": "\uE790",
"Description": "Guide showing how to use colors in your app.",
"ImagePath": "Assets/ControlImages/ColorPaletteResources.png"
},
{
"UniqueId": "Typography",
"Title": "Typography",
"PageName": "TypographyPage",
"IconGlyph": "\uE8D2",
"Description": "Guide showing how to use typography in your app.",
"ImagePath": "Assets/ControlImages/TextBlock.png"
},
{
"UniqueId": "Icons",
"Title": "Icons",
"PageName": "IconsPage",
"IconGlyph": "\uED58",
"Description": "Guide showing how to use icons in your app.",
"ImagePath": "Assets/ControlImages/IconElement.png"
}
]
},
{
"UniqueId": "Samples",
"Title": "Samples",
"PageName": "SamplesPage",
"IconGlyph": "\uEF58",
"IsGroup": true,
"Items": [
{
"UniqueId": "User Dashboard",
"Title": "User Dashboard",
"PageName": "UserDashboardPage",
"Description": "A dashboard for a user to view and interact with.",
"ImagePath": "Assets/ControlImages/PersonPicture.png"
}
]
},
{
"UniqueId": "All Controls",
"Title": "All Controls",
"PageName": "AllSamplesPage",
"IconGlyph": "\uE71D"
},
{
"UniqueId": "Basic Input",
"Title": "Basic Input",
"PageName": "BasicInputPage",
"IconGlyph": "\uE73A",
"Description": "Button, CheckBox, ComboBox, RadioButton, Slider.",
"ImagePath": "Assets/ControlImages/Button.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "Button",
"Title": "Button",
"PageName": "ButtonPage",
"ImagePath": "Assets/ControlImages/Button.png",
"Description": "A control that responds to user input and raises a Click event."
},
{
"UniqueId": "CheckBox",
"Title": "CheckBox",
"PageName": "CheckBoxPage",
"ImagePath": "Assets/ControlImages/CheckBox.png",
"Description": "A control that a user can select or clear."
},
{
"UniqueId": "ComboBox",
"Title": "ComboBox",
"PageName": "ComboBoxPage",
"ImagePath": "Assets/ControlImages/CheckBox.png",
"Description": "A drop-down list of items a user can select from."
},
{
"UniqueId": "RadioButton",
"Title": "RadioButton",
"PageName": "RadioButtonPage",
"ImagePath": "Assets/ControlImages/RadioButton.png",
"Description": "A control that allows a user to select a single option from a group of options."
},
{
"UniqueId": "Slider",
"Title": "Slider",
"PageName": "SliderPage",
"ImagePath": "Assets/ControlImages/Slider.png",
"Description": "A control that lets the user select from a range of values by moving a Thumb control along a track."
}
]
},
{
"UniqueId": "Collections",
"Title": "Collections",
"PageName": "CollectionsPage",
"IconGlyph": "\uE80A",
"Description": "DataGrid, ListBox, ListView, TreeView.",
"ImagePath": "Assets/ControlImages/DataGrid.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "DataGrid",
"Title": "DataGrid",
"PageName": "DataGridPage",
"ImagePath": "Assets/ControlImages/DataGrid.png",
"Description": "The DataGrid control presents data in a customizable table of rows and columns."
},
{
"UniqueId": "ListBox",
"Title": "ListBox",
"PageName": "ListBoxPage",
"ImagePath": "Assets/ControlImages/Listbox.png",
"Description": "A control that presents an inline list of items that the user can select from."
},
{
"UniqueId": "ListView",
"Title": "ListView",
"PageName": "ListViewPage",
"ImagePath": "Assets/ControlImages/ListView.png",
"Description": "A control that presents a collection of items in a vertical list."
},
{
"UniqueId": "TreeView",
"Title": "TreeView",
"PageName": "TreeViewPage",
"ImagePath": "Assets/ControlImages/TreeView.png",
"Description": "The TreeView control is a hierarchical list pattern with expanding and collapsing nodes that contain nested items."
}
]
},
{
"UniqueId": "Date & Calendar",
"Title": "Date & Calendar",
"PageName": "DateAndTimePage",
"IconGlyph": "\uEC92",
"Description": "Calendar, DatePicker.",
"ImagePath": "Assets/ControlImages/CalendarView.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "Calendar",
"Title": "Calendar",
"PageName": "CalendarPage",
"ImagePath": "Assets/ControlImages/CalendarView.png",
"Description": "A control that presents a calendar for a user to choose a date from."
},
{
"UniqueId": "DatePicker",
"Title": "DatePicker",
"PageName": "DatePickerPage",
"ImagePath": "Assets/ControlImages/DatePicker.png",
"Description": "A control that lets a user pick a date value."
}
]
},
{
"UniqueId": "Layout",
"Title": "Layout",
"PageName": "LayoutPage",
"IconGlyph": "\uF246",
"Description": "Expander",
"ImagePath": "Assets/ControlImages/Expander.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "Expander",
"Title": "Expander",
"PageName": "ExpanderPage",
"ImagePath": "Assets/ControlImages/Expander.png",
"Description": "A container with a header that can be expanded to show a body with more content."
}
]
},
{
"UniqueId": "Navigation",
"Title": "Navigation",
"PageName": "NavigationPage",
"IconGlyph": "\uE700",
"Description": "Menu, TabControl.",
"ImagePath": "Assets/ControlImages/Pivot.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "Menu",
"Title": "Menu",
"PageName": "MenuPage",
"ImagePath": "Assets/ControlImages/Pivot.png",
"Description": "A classic menu, allowing the display of MenuItems containing MenuFlyoutItems."
},
{
"UniqueId": "TabControl",
"Title": "TabControl",
"PageName": "TabControlPage",
"ImagePath": "Assets/ControlImages/TabView.png",
"Description": "A control that displays a collection of tabs."
}
]
},
{
"UniqueId": "Status & Info",
"Title": "Status & Info",
"PageName": "StatusAndInfoPage",
"IconGlyph": "\uE8F2",
"Description": "ProgressBar, ToolTip.",
"ImagePath": "Assets/ControlImages/ProgressBar.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "ProgressBar",
"Title": "ProgressBar",
"PageName": "ProgressBarPage",
"ImagePath": "Assets/ControlImages/ProgressBar.png",
"Description": "Shows the apps progress on a task, or that the app is performing ongoing work that doesn't block user interaction."
},
{
"UniqueId": "ToolTip",
"Title": "ToolTip",
"PageName": "ToolTipPage",
"ImagePath": "Assets/ControlImages/ToolTip.png",
"Description": "Displays information for an element in a pop-up window."
}
]
},
{
"UniqueId": "Text",
"Title": "Text",
"PageName": "TextPage",
"IconGlyph": "\uE8D2",
"Description": "Label, TextBox, TextBlock, RichTextEdit, PasswordBox.",
"ImagePath": "Assets/ControlImages/TextBlock.png",
"IsGroup": true,
"Items": [
{
"UniqueId": "Label",
"Title": "Label",
"PageName": "LabelPage",
"ImagePath": "Assets/ControlImages/Button.png",
"Description": "Caption of an item."
},
{
"UniqueId": "TextBox",
"Title": "TextBox",
"PageName": "TextBoxPage",
"ImagePath": "Assets/ControlImages/TextBox.png",
"Description": "A single-line or multi-line plain text field."
},
{
"UniqueId": "TextBlock",
"Title": "TextBlock",
"PageName": "TextBlockPage",
"ImagePath": "Assets/ControlImages/TextBlock.png",
"Description": "A lightweight control for displaying small amounts of text."
},
{
"UniqueId": "RichTextEdit",
"Title": "RichTextEdit",
"PageName": "RichTextEditPage",
"ImagePath": "Assets/ControlImages/RichEditBox.png",
"Description": "A control that displays formatted text, hyperlinks, inline images, and other rich content."
},
{
"UniqueId": "PasswordBox",
"Title": "PasswordBox",
"PageName": "PasswordBoxPage",
"ImagePath": "Assets/ControlImages/PasswordBox.png",
"Description": "A control for entering passwords."
}
]
}
]
Loading

0 comments on commit c51692d

Please sign in to comment.