diff --git a/Sample Applications/WPFGallery/App.xaml.cs b/Sample Applications/WPFGallery/App.xaml.cs
index c49b6cef..47105b9b 100644
--- a/Sample Applications/WPFGallery/App.xaml.cs
+++ b/Sample Applications/WPFGallery/App.xaml.cs
@@ -6,7 +6,6 @@
using WPFGallery.Navigation;
using WPFGallery.ViewModels;
using WPFGallery.Views;
-using WPFGallery.Views.Samples;
using WPFGallery.ViewModels.Samples;
namespace WPFGallery;
diff --git a/Sample Applications/WPFGallery/MainWindow.xaml b/Sample Applications/WPFGallery/MainWindow.xaml
index c22fcb40..68b1d820 100644
--- a/Sample Applications/WPFGallery/MainWindow.xaml
+++ b/Sample Applications/WPFGallery/MainWindow.xaml
@@ -220,7 +220,7 @@
PreviewKeyDown="ControlsList_PreviewKeyDown"
PreviewMouseLeftButtonUp="ControlsList_PreviewMouseLeftButtonUp">
-
+
@@ -230,16 +230,16 @@
+ Text="{Binding IconGlyph}"
+ Visibility="{Binding IconGlyph, Converter={StaticResource EmptyToVisibilityConverter}}" />
+ Text="{Binding Title}" />
diff --git a/Sample Applications/WPFGallery/MainWindow.xaml.cs b/Sample Applications/WPFGallery/MainWindow.xaml.cs
index 18fe1c0f..d692614b 100644
--- a/Sample Applications/WPFGallery/MainWindow.xaml.cs
+++ b/Sample Applications/WPFGallery/MainWindow.xaml.cs
@@ -5,6 +5,7 @@
using System.Windows.Shell;
using WPFGallery.Navigation;
using WPFGallery.ViewModels;
+using WPFGallery.Models;
using WPFGallery.Views;
namespace WPFGallery;
@@ -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;
@@ -167,13 +168,13 @@ private void CloseWindow(object sender, RoutedEventArgs e)
private void OnNavigating(object? sender, NavigatingEventArgs e)
{
- List list = ViewModel.GetNavigationItemHierarchyFromPageType(e.PageType);
+ List 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)
diff --git a/Sample Applications/WPFGallery/Models/ControlsInfoData.json b/Sample Applications/WPFGallery/Models/ControlsInfoData.json
new file mode 100644
index 00000000..5a0f529a
--- /dev/null
+++ b/Sample Applications/WPFGallery/Models/ControlsInfoData.json
@@ -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."
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/Sample Applications/WPFGallery/Models/ControlsInfoDataSource.cs b/Sample Applications/WPFGallery/Models/ControlsInfoDataSource.cs
new file mode 100644
index 00000000..116b08bc
--- /dev/null
+++ b/Sample Applications/WPFGallery/Models/ControlsInfoDataSource.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using System.Threading.Tasks;
+
+
+namespace WPFGallery.Models
+{
+ public class ControlInfoDataItem
+ {
+ public string UniqueId { get; set; }
+ public string Title { get; set; }
+ public string Description { get; set; }
+ public string IconGlyph { get; set; }
+ public string ImagePath { get; set; }
+ public string PageName { get; set; }
+ public bool IsGroup { get; set; } = false;
+
+ public Type PageType
+ {
+ get
+ {
+ return _assembly.GetType($"WPFGallery.Views.{PageName}");
+ }
+ }
+
+ public Uri ImageSource
+ {
+ get
+ {
+ return new Uri($"pack://application:,,,/{ImagePath}");
+ }
+ }
+
+ public ObservableCollection Items { get; set; } = new ObservableCollection();
+
+ public override string ToString()
+ {
+ return Title;
+ }
+
+ private static Assembly _assembly = typeof(ControlsInfoDataSource).Assembly;
+ }
+
+ public sealed class ControlsInfoDataSource
+ {
+ private static readonly object _lock = new();
+
+ #region Singleton
+
+ private static readonly ControlsInfoDataSource _instance;
+
+ public static ControlsInfoDataSource Instance
+ {
+ get
+ {
+ return _instance;
+ }
+ }
+
+ static ControlsInfoDataSource()
+ {
+ _instance = new ControlsInfoDataSource();
+ }
+
+ private ControlsInfoDataSource()
+ {
+ var jsonText = ReadControlsData();
+ ControlsInfo = JsonSerializer.Deserialize>(jsonText);
+ }
+
+ #endregion
+
+ public ICollection ControlsInfo { get; }
+
+ private string ReadControlsData()
+ {
+ var assembly = typeof(ControlsInfoDataSource).Assembly;
+ var resourceName = "WPFGallery.Models.ControlsInfoData.json";
+
+ using (var stream = assembly.GetManifestResourceStream(resourceName))
+ using (var reader = new System.IO.StreamReader(stream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
+
+ public ICollection GetControlsInfo(string groupName)
+ {
+ return ControlsInfo.Where(x => x.UniqueId == groupName).FirstOrDefault()?.Items;
+ }
+
+ public ICollection GetAllControlsInfo()
+ {
+ ICollection allControls = new ObservableCollection();
+ foreach (ControlInfoDataItem ci in ControlsInfo)
+ {
+ if(ci.UniqueId != "Samples")
+ {
+ var items = ci.Items;
+ foreach (ControlInfoDataItem item in items)
+ {
+ allControls.Add(item);
+ }
+ }
+ }
+
+ return allControls;
+ }
+
+ public ICollection GetGroupedControlsInfo()
+ {
+ return ControlsInfo.Where(x => x.IsGroup == true && x.UniqueId != "Design Guidance" && x.UniqueId != "Samples").ToList();
+ }
+ }
+}
diff --git a/Sample Applications/WPFGallery/Navigation/NavigationCard.cs b/Sample Applications/WPFGallery/Navigation/NavigationCard.cs
deleted file mode 100644
index 5e6fd77f..00000000
--- a/Sample Applications/WPFGallery/Navigation/NavigationCard.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-
-namespace WPFGallery.Navigation
-{
- ///
- /// Represents a navigation card that can be used to navigate to a page.
- ///
- public class NavigationCard
- {
- public string Name { get; set; } = "";
- public Type? PageType { get; set; } = null;
-
- public string Description { get; set; } = "";
-
- //public IconElement? Icon { get; set; } = null;
-
- public Object? Icon { get; set; } = null;
-
- public NavigationCard() { }
-
- public NavigationCard(string name, Type pageType, string description = "")
- {
- Name = name;
- PageType = pageType;
- Description = description;
- }
-
- public override string ToString()
- {
- return Name;
- }
- }
-
-}
diff --git a/Sample Applications/WPFGallery/Navigation/NavigationItem.cs b/Sample Applications/WPFGallery/Navigation/NavigationItem.cs
deleted file mode 100644
index 0ee34607..00000000
--- a/Sample Applications/WPFGallery/Navigation/NavigationItem.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-
-namespace WPFGallery.Navigation
-{
- ///
- /// NavigationItem class
- ///
- public class NavigationItem
- {
- public string Name { get; set; } = "";
- public Type? PageType { get; set; } = null;
-
- public ICollection Children { get; set; } = new ObservableCollection();
-
- public string Icon { get; set; } = "";
-
- public NavigationItem() { }
-
- public NavigationItem(string name, Type pageType)
- {
- Name = name;
- PageType = pageType;
- }
-
- public NavigationItem(string name, Type pageType, ObservableCollection navItems)
- {
- Name = name;
- PageType = pageType;
- Children = navItems;
- }
-
- public override string ToString()
- {
- return Name;
- }
- }
-
-}
diff --git a/Sample Applications/WPFGallery/ViewModels/AllSamplesPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/AllSamplesPageViewModel.cs
index f89ab46e..7b73dd82 100644
--- a/Sample Applications/WPFGallery/ViewModels/AllSamplesPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/AllSamplesPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,178 +13,7 @@ public partial class AllSamplesPageViewModel : ObservableObject
private string _pageDescription = "";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Button",
- PageType = typeof(ButtonPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Button.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.ControlButton24 },
- Description = "A control that responds to user input and raises a Click event."
- },
- new NavigationCard
- {
- Name = "CheckBox",
- PageType = typeof(CheckBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Checkbox.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "A control that a user can select or clear."
- },
- new NavigationCard
- {
- Name = "ComboBox",
- PageType = typeof(ComboBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ComboBox.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.Filter16 },
- Description = "A drop-down list of items a user can select from."
- },
- new NavigationCard
- {
- Name = "RadioButton",
- PageType = typeof(RadioButtonPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/RadioButton.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.RadioButton24 },
- Description = "A control that allows a user to select a single option from a group of options."
- },
- new NavigationCard
- {
- Name = "Slider",
- PageType = typeof(SliderPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Slider.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.HandDraw24 },
- Description = "A control that lets the user select from a range of values by moving a Thumb control along a track."
- },
- new NavigationCard
- {
- Name = "Data Grid",
- PageType = typeof(DataGridPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/DataGrid.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.GridKanban20 },
- Description = "The DataGrid control presents data in a customizable table of rows and columns."
- },
- new NavigationCard
- {
- Name = "ListBox",
- PageType = typeof(ListBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ListBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.AppsListDetail24 },
- Description = "A control that presents an inline list of items that the user can select from."
- },
- new NavigationCard
- {
- Name = "ListView",
- PageType = typeof(ListViewPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ListView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.GroupList24 },
- Description = "A control that presents a collection of items in a vertical list."
- },
- new NavigationCard
- {
- Name = "TreeView",
- PageType = typeof(TreeViewPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TreeView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextBulletListTree24 },
- Description = "The TreeView control is a hierarchical list pattern with expanding and collapsing nodes that contain nested items."
- },
- new NavigationCard
- {
- Name = "Calendar",
- PageType = typeof(CalendarPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/CalendarView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CalendarLtr24 },
- Description = "A control that presents a calendar for a user to choose a date from."
- },
- new NavigationCard
- {
- Name = "DatePicker",
- PageType = typeof(DatePickerPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/DatePicker.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CalendarSearch20 },
- Description = "A control that lets a user pick a date value."
- },
- new NavigationCard
- {
- Name = "Expander",
- PageType = typeof(ExpanderPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Expander.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "A container with a header that can be expanded to show a body with more content."
- },
- new NavigationCard
- {
- Name = "Menu",
- PageType = typeof(MenuPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Pivot.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.RowTriple24 },
- Description = "A classic menu, allowing the display of MenuItems containing MenuFlyoutItems."
- },
- new NavigationCard
- {
- Name = "TabControl",
- PageType = typeof(TabControlPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TabView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TabDesktopBottom24 },
- Description = "A control that displays a collection of tabs."
- },
- new NavigationCard
- {
- Name = "ProgressBar",
- PageType = typeof(ProgressBarPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ProgressBar.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.ArrowDownload24 },
- Description = "Shows the apps progress on a task, or that the app is performing ongoing work that doesn't block user interaction."
- },
- new NavigationCard
- {
- Name = "ToolTip",
- PageType = typeof(ToolTipPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ToolTip.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Comment24 },
- Description = "Displays information for an element in a pop-up window."
- },
- new NavigationCard
- {
- Name = "Label",
- PageType = typeof(LabelPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Button.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextBaseline20 },
- Description = "Caption of an item."
- },
- new NavigationCard
- {
- Name = "TextBlock",
- PageType = typeof(TextBlockPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBlock.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextCaseLowercase24 },
- Description = "A lightweight control for displaying small amounts of text."
- },
- new NavigationCard
- {
- Name = "TextBox",
- PageType = typeof(TextBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextColor24 },
- Description = "A single-line or multi-line plain text field."
- },
- new NavigationCard
- {
- Name = "RichTextEdit",
- PageType = typeof(RichTextEditPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/RichEditBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.DrawText24 },
- Description = "A control that displays formatted text, hyperlinks, inline images, and other rich content."
- },
- new NavigationCard
- {
- Name = "PasswordBox",
- PageType = typeof(PasswordBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/PasswordBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Password24 },
- Description = "A control for entering passwords."
- },
- };
-
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetAllControlsInfo();
private readonly INavigationService _navigationService;
public AllSamplesPageViewModel(INavigationService navigationService)
diff --git a/Sample Applications/WPFGallery/ViewModels/BasicInputPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/BasicInputPageViewModel.cs
index b8d5fa5a..7a445895 100644
--- a/Sample Applications/WPFGallery/ViewModels/BasicInputPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/BasicInputPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,50 +13,7 @@ public partial class BasicInputPageViewModel : ObservableObject
private string _pageDescription = "Controls for getting user input";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Button",
- PageType = typeof(ButtonPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Button.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.ControlButton24 },
- Description = "A control that responds to user input and raises a Click event."
- },
- new NavigationCard
- {
- Name = "CheckBox",
- PageType = typeof(CheckBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Checkbox.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "A control that a user can select or clear."
- },
- new NavigationCard
- {
- Name = "ComboBox",
- PageType = typeof(ComboBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ComboBox.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.Filter16 },
- Description = "A drop-down list of items a user can select from."
- },
- new NavigationCard
- {
- Name = "RadioButton",
- PageType = typeof(RadioButtonPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/RadioButton.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.RadioButton24 },
- Description = "A control that allows a user to select a single option from a group of options."
- },
- new NavigationCard
- {
- Name = "Slider",
- PageType = typeof(SliderPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Slider.png"))},
- //Icon = new SymbolIcon { Symbol = SymbolRegular.HandDraw24 },
- Description = "A control that lets the user select from a range of values by moving a Thumb control along a track."
- },
-
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Basic Input");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/CollectionsPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/CollectionsPageViewModel.cs
index ff57d51c..5cfd2c51 100644
--- a/Sample Applications/WPFGallery/ViewModels/CollectionsPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/CollectionsPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -13,41 +14,7 @@ public partial class CollectionsPageViewModel : ObservableObject
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Data Grid",
- PageType = typeof(DataGridPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/DataGrid.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.GridKanban20 },
- Description = "The DataGrid control presents data in a customizable table of rows and columns."
- },
- new NavigationCard
- {
- Name = "ListBox",
- PageType = typeof(ListBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ListBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.AppsListDetail24 },
- Description = "A control that presents an inline list of items that the user can select from."
- },
- new NavigationCard
- {
- Name = "ListView",
- PageType = typeof(ListViewPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ListView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.GroupList24 },
- Description = "A control that presents a collection of items in a vertical list."
- },
- new NavigationCard
- {
- Name = "TreeView",
- PageType = typeof(TreeViewPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TreeView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextBulletListTree24 },
- Description = "The TreeView control is a hierarchical list pattern with expanding and collapsing nodes that contain nested items."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Collections");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/DashboardPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/DashboardPageViewModel.cs
index 9a38692e..6222cfdd 100644
--- a/Sample Applications/WPFGallery/ViewModels/DashboardPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/DashboardPageViewModel.cs
@@ -1,77 +1,14 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
public partial class DashboardPageViewModel : ObservableObject
{
+
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Basic Input",
- PageType = typeof(BasicInputPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Button.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "Button, CheckBox, ComboBox, RadioButton, Slider."
- },
- new NavigationCard
- {
- Name = "Collections",
- PageType = typeof(CollectionsPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/DataGrid.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Table24 },
- Description = "DataGrid, ListBox, ListView, TreeView."
- },
- new NavigationCard
- {
- Name = "Date & Time",
- PageType = typeof(DateAndTimePage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/CalendarView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CalendarClock24 },
- Description = "Calendar, DatePicker"
- },
- new NavigationCard
- {
- Name = "Layout",
- PageType = typeof(LayoutPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Expander.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.News24 },
- Description = "Expander"
- },
- // new NavigationCard
- // {
- // Name = "Media",
- // PageType = typeof(MediaPage),
- // Icon = newSymbolIcon { Symbol = SymbolRegular.PlayCircle24 },
- // Description = "Canvas, Image"
- // },
- new NavigationCard
- {
- Name = "Navigation",
- PageType = typeof(NavigationPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/MenuBar.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Navigation24 },
- Description = "Menu, TabControl"
- },
- new NavigationCard
- {
- Name = "Status & Info",
- PageType = typeof(StatusAndInfoPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ProgressBar.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.ChatBubblesQuestion24 },
- Description = "ProgressBar, ToolTip"
- },
- new NavigationCard
- {
- Name = "Text",
- PageType = typeof(TextPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBlock.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.DrawText24 },
- Description = "Label, TextBlock, TextBox, RichTextEdit, PasswordBox."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetGroupedControlsInfo();
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/DateAndTimePageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/DateAndTimePageViewModel.cs
index b1230ef3..b1b7d0a4 100644
--- a/Sample Applications/WPFGallery/ViewModels/DateAndTimePageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/DateAndTimePageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,25 +13,7 @@ public partial class DateAndTimePageViewModel : ObservableObject
private string _pageDescription = "Controls for date and calendar";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Calendar",
- PageType = typeof(CalendarPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/CalendarView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CalendarLtr24 },
- Description = "A control that presents a calendar for a user to choose a date from."
- },
- new NavigationCard
- {
- Name = "DatePicker",
- PageType = typeof(DatePickerPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/DatePicker.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CalendarSearch20 },
- Description = "A control that lets a user pick a date value."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Date & Calendar");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/DesignGuidancePageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/DesignGuidancePageViewModel.cs
index 781902cb..14634e0b 100644
--- a/Sample Applications/WPFGallery/ViewModels/DesignGuidancePageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/DesignGuidancePageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,30 +13,7 @@ public partial class DesignGuidancePageViewModel : ObservableObject
private string _pageDescription = "Design guidelines on how to use colors, typography, and icons in your app.";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Colors",
- PageType = typeof(ColorsPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ColorPaletteResources.png"))},
- Description = "Guide showing how to use colors in your app"
- },
- new NavigationCard
- {
- Name = "Typography",
- PageType = typeof(TypographyPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBlock.png"))},
- Description = "Guide showing how to use typography in your app"
- },
- new NavigationCard
- {
- Name = "Icons",
- PageType = typeof(IconsPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/IconElement.png"))},
- Description = "Guide showing how to use icons in your app"
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Design Guidance");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/LayoutPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/LayoutPageViewModel.cs
index 109955c1..0faa77c9 100644
--- a/Sample Applications/WPFGallery/ViewModels/LayoutPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/LayoutPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,17 +13,7 @@ public partial class LayoutPageViewModel : ObservableObject
private string _pageDescription = "Controls for layouting";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Expander",
- PageType = typeof(ExpanderPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Expander.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "A container with a header that can be expanded to show a body with more content."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Layout");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/MainWindowViewModel.cs b/Sample Applications/WPFGallery/ViewModels/MainWindowViewModel.cs
index 2e4579a5..848a4387 100644
--- a/Sample Applications/WPFGallery/ViewModels/MainWindowViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/MainWindowViewModel.cs
@@ -3,7 +3,7 @@
using System.Windows.Threading;
using WPFGallery.Navigation;
using WPFGallery.Views;
-using WPFGallery.Views.Samples;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels;
@@ -17,156 +17,9 @@ public partial class MainWindowViewModel : ObservableObject
private string _searchText = string.Empty;
[ObservableProperty]
- private ICollection _controls = new ObservableCollection
- {
- new NavigationItem
- {
- Name = "Home",
- PageType = typeof(DashboardPage),
- Icon = "\xE80F"
- },
- new NavigationItem
- {
-
- Name = "Design Guidance",
- PageType = typeof(DesignGuidancePage),
- Icon = "\xEB3C",
- Children = new ObservableCollection
- {
- new NavigationItem
- {
- Name = "Colors",
- PageType = typeof(ColorsPage),
- Icon = "\xE790"
- },
- new NavigationItem
- {
- Name = "Typography",
- PageType = typeof(TypographyPage),
- Icon = "\xE8D2"
- },
- new NavigationItem
- {
- Name = "Icons",
- PageType = typeof(IconsPage),
- Icon = "\xED58"
- },
- }
- },
- new NavigationItem
- {
- Name = "Samples",
- PageType = typeof(SamplesPage),
- Icon = "\xEF58",
- Children = new ObservableCollection
- {
- new NavigationItem("User Dashboard", typeof(UserDashboardPage)),
- }
- },
- new NavigationItem
- {
- Name = "All Controls",
- PageType = typeof(AllSamplesPage),
- Icon = "\xE71D",
- },
- new NavigationItem
- {
- Name = "Basic Input",
- PageType = typeof(BasicInputPage),
- Icon = "\xE73A",
- Children = new ObservableCollection
- {
- new NavigationItem("Button", typeof(ButtonPage)),
- new NavigationItem("CheckBox", typeof(CheckBoxPage)),
- new NavigationItem("ComboBox", typeof(ComboBoxPage)),
- new NavigationItem("RadioButton", typeof(RadioButtonPage)),
- new NavigationItem("Slider", typeof(SliderPage)),
- }
- },
- new NavigationItem
- {
- Name="Collections",
- PageType = typeof(CollectionsPage),
- Icon = "\xE80A",
- Children = new ObservableCollection
- {
- new NavigationItem("DataGrid", typeof(DataGridPage)),
- new NavigationItem("ListBox", typeof(ListBoxPage)),
- new NavigationItem("ListView", typeof(ListViewPage)),
- new NavigationItem("TreeView", typeof(TreeViewPage)),
- }
- },
- new NavigationItem
- {
- Name="Date & Calendar",
- PageType = typeof(DateAndTimePage),
- Icon = "\xEC92",
- Children = new ObservableCollection
- {
- new NavigationItem("Calendar", typeof(CalendarPage)),
- new NavigationItem("DatePicker", typeof(DatePickerPage)),
- }
- },
- new NavigationItem
- {
- Name = "Layout",
- PageType = typeof(LayoutPage),
- Icon = "\xF246",
- Children = new ObservableCollection
- {
- new NavigationItem("Expander", typeof(ExpanderPage)),
- }
- },
- // new NavigationItem
- // {
- // Name = "Media",
- // PageType = typeof(MediaPage),
- // Children = new ObservableCollection
- // {
- // new NavigationItem("Canvas", typeof(CanvasPage)),
- // new NavigationItem("Image", typeof(ImagePage)),
- // }
- // },
- new NavigationItem
- {
- Name = "Navigation",
- PageType = typeof(NavigationPage),
- Icon = "\xE700",
- Children = new ObservableCollection
- {
- new NavigationItem("Menu", typeof(MenuPage)),
- new NavigationItem("TabControl", typeof(TabControlPage)),
- }
- },
- new NavigationItem
- {
- Name = "Status & Info",
- PageType = typeof(StatusAndInfoPage),
- Icon = "\xE8F2",
- Children = new ObservableCollection
- {
- new NavigationItem("ProgressBar", typeof(ProgressBarPage)),
- new NavigationItem("ToolTip", typeof(ToolTipPage)),
- }
- },
- new NavigationItem
- {
- Name = "Text",
- PageType = typeof(TextPage),
- Icon = "\xE8D2",
- Children = new ObservableCollection
- {
- new NavigationItem("Label", typeof(LabelPage)),
- new NavigationItem("TextBox", typeof(TextBoxPage)),
- new NavigationItem("TextBlock", typeof(TextBlockPage)),
- new NavigationItem("RichTextEdit", typeof(RichTextEditPage)),
- new NavigationItem("PasswordBox", typeof(PasswordBoxPage)),
- }
- },
- };
-
+ private ICollection _controls;
[ObservableProperty]
- private NavigationItem? _selectedControl;
+ private ControlInfoDataItem? _selectedControl;
private readonly INavigationService _navigationService;
[ObservableProperty]
private bool _canNavigateback;
@@ -197,7 +50,9 @@ public void Forward()
public MainWindowViewModel(INavigationService navigationService)
{
+ _controls = ControlsInfoDataSource.Instance.ControlsInfo;
_navigationService = navigationService;
+
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(400);
_timer.Tick += PerformSearchNavigation;
@@ -221,7 +76,7 @@ private void PerformSearchNavigation(object? sender, EventArgs e)
_navigationService.NavigateTo(GetNavigationPageTypeFromName(_searchText, _controls));
}
- private Type? GetNavigationPageTypeFromName(string name, ICollection pages)
+ private Type? GetNavigationPageTypeFromName(string name, ICollection pages)
{
Type? type = null;
@@ -232,12 +87,12 @@ private void PerformSearchNavigation(object? sender, EventArgs e)
foreach(var item in pages)
{
- if (item.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
+ if (item.Title.Equals(name, StringComparison.OrdinalIgnoreCase))
{
return item.PageType!;
}
- type = GetNavigationPageTypeFromName(name, item.Children);
+ type = GetNavigationPageTypeFromName(name, item.Items);
if(type != null)
{
@@ -247,11 +102,11 @@ private void PerformSearchNavigation(object? sender, EventArgs e)
return null;
}
- internal List GetNavigationItemHierarchyFromPageType(Type? pageType)
+ internal List GetNavigationItemHierarchyFromPageType(Type? pageType)
{
- List list = new List();
- Stack _stack = new Stack();
- Stack _revStack = new Stack();
+ List list = new List();
+ Stack _stack = new Stack();
+ Stack _revStack = new Stack();
if(pageType == null)
{
@@ -263,7 +118,7 @@ internal List GetNavigationItemHierarchyFromPageType(Type? pageT
foreach(var item in Controls)
{
_stack.Push(item);
- found = FindNavigationItemsHierarchyFromPageType(pageType, item.Children, ref _stack);
+ found = FindNavigationItemsHierarchyFromPageType(pageType, item.Items, ref _stack);
if(found)
{
break;
@@ -284,7 +139,7 @@ internal List GetNavigationItemHierarchyFromPageType(Type? pageT
return list;
}
- private bool FindNavigationItemsHierarchyFromPageType(Type pageType, ICollection pages, ref Stack stack)
+ private bool FindNavigationItemsHierarchyFromPageType(Type pageType, ICollection pages, ref Stack stack)
{
var item = stack.Peek();
bool found = false;
@@ -294,10 +149,10 @@ private bool FindNavigationItemsHierarchyFromPageType(Type pageType, ICollection
return true;
}
- foreach(var child in item.Children)
+ foreach(var child in item.Items)
{
stack.Push(child);
- found = FindNavigationItemsHierarchyFromPageType(pageType, child.Children, ref stack);
+ found = FindNavigationItemsHierarchyFromPageType(pageType, child.Items, ref stack);
if(found) { return true; }
stack.Pop();
}
@@ -309,4 +164,5 @@ internal void UpdateCanNavigateBack()
{
CanNavigateback = _navigationService.IsBackHistoryNonEmpty();
}
+
}
diff --git a/Sample Applications/WPFGallery/ViewModels/MediaPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/MediaPageViewModel.cs
index 77f0ffcf..f68e4bba 100644
--- a/Sample Applications/WPFGallery/ViewModels/MediaPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/MediaPageViewModel.cs
@@ -1,6 +1,7 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -13,23 +14,7 @@ public partial class MediaPageViewModel : ObservableObject
private string _pageDescription = "Controls for media presentation";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Canvas",
- PageType = typeof(CanvasPage),
- // Icon = newSymbolIcon { Symbol = SymbolRegular.InkStroke24 },
- Description = "Canvas presenter"
- },
- new NavigationCard
- {
- Name = "Image",
- PageType = typeof(ImagePage),
- // Icon = newSymbolIcon { Symbol = SymbolRegular.ImageMultiple24 },
- Description = "Image presente"
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Media");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/NavigationPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/NavigationPageViewModel.cs
index c47ac963..6bb1378c 100644
--- a/Sample Applications/WPFGallery/ViewModels/NavigationPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/NavigationPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,25 +13,7 @@ public partial class NavigationPageViewModel : ObservableObject
private string _pageDescription = "Controls for navigation and actions";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Menu",
- PageType = typeof(MenuPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Pivot.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.RowTriple24 },
- Description = "A classic menu, allowing the display of MenuItems containing MenuFlyoutItems."
- },
- new NavigationCard
- {
- Name = "TabControl",
- PageType = typeof(TabControlPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TabView.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TabDesktopBottom24 },
- Description = "A control that displays a collection of tabs."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Navigation");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/SamplesPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/SamplesPageViewModel.cs
index ec27b3c9..6e66c603 100644
--- a/Sample Applications/WPFGallery/ViewModels/SamplesPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/SamplesPageViewModel.cs
@@ -1,5 +1,6 @@
-using WPFGallery.Navigation;
-using WPFGallery.Views.Samples;
+using WPFGallery.Navigation;
+using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,17 +13,7 @@ public partial class SamplesPageViewModel : ObservableObject
private string _pageDescription = "Sample pages for common scenarios";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "User Dashboard",
- PageType = typeof(UserDashboardPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/PersonPicture.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.CheckboxChecked24 },
- Description = "User Dashboard Page"
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Samples");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/StatusAndInfoPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/StatusAndInfoPageViewModel.cs
index 0bf0a2f5..efbac7e5 100644
--- a/Sample Applications/WPFGallery/ViewModels/StatusAndInfoPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/StatusAndInfoPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,25 +13,7 @@ public partial class StatusAndInfoPageViewModel : ObservableObject
private string _pageDescription = "Controls to show progress and extra information";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "ProgressBar",
- PageType = typeof(ProgressBarPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ProgressBar.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.ArrowDownload24 },
- Description = "Shows the apps progress on a task, or that the app is performing ongoing work that doesn't block user interaction."
- },
- new NavigationCard
- {
- Name = "ToolTip",
- PageType = typeof(ToolTipPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/ToolTip.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Comment24 },
- Description = "Displays information for an element in a pop-up window."
- },
- };
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Status & Info");
private readonly INavigationService _navigationService;
diff --git a/Sample Applications/WPFGallery/ViewModels/TextPageViewModel.cs b/Sample Applications/WPFGallery/ViewModels/TextPageViewModel.cs
index eba7d3d4..584313e1 100644
--- a/Sample Applications/WPFGallery/ViewModels/TextPageViewModel.cs
+++ b/Sample Applications/WPFGallery/ViewModels/TextPageViewModel.cs
@@ -1,5 +1,6 @@
using WPFGallery.Navigation;
using WPFGallery.Views;
+using WPFGallery.Models;
namespace WPFGallery.ViewModels
{
@@ -12,50 +13,7 @@ public partial class TextPageViewModel : ObservableObject
private string _pageDescription = "Controls for displaying and editing text";
[ObservableProperty]
- private ICollection _navigationCards = new ObservableCollection
- {
- new NavigationCard
- {
- Name = "Label",
- PageType = typeof(LabelPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/Button.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextBaseline20 },
- Description = "Caption of an item."
- },
- new NavigationCard
- {
- Name = "TextBlock",
- PageType = typeof(TextBlockPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBlock.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextCaseLowercase24 },
- Description = "A lightweight control for displaying small amounts of text."
- },
- new NavigationCard
- {
- Name = "TextBox",
- PageType = typeof(TextBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/TextBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.TextColor24 },
- Description = "A single-line or multi-line plain text field."
- },
- new NavigationCard
- {
- Name = "RichTextEdit",
- PageType = typeof(RichTextEditPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/RichEditBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.DrawText24 },
- Description = "A control that displays formatted text, hyperlinks, inline images, and other rich content."
- },
- new NavigationCard
- {
- Name = "PasswordBox",
- PageType = typeof(PasswordBoxPage),
- Icon = new Image {Source= new BitmapImage(new Uri("pack://application:,,,/Assets/ControlImages/PasswordBox.png"))},
- // Icon = newSymbolIcon { Symbol = SymbolRegular.Password24 },
- Description = "A control for entering passwords."
- },
- };
-
+ private ICollection _navigationCards = ControlsInfoDataSource.Instance.GetControlsInfo("Text");
private readonly INavigationService _navigationService;
public TextPageViewModel(INavigationService navigationService)
diff --git a/Sample Applications/WPFGallery/Views/AllSamplesPage.xaml b/Sample Applications/WPFGallery/Views/AllSamplesPage.xaml
index 3bc7e11e..1c121a2d 100644
--- a/Sample Applications/WPFGallery/Views/AllSamplesPage.xaml
+++ b/Sample Applications/WPFGallery/Views/AllSamplesPage.xaml
@@ -39,20 +39,23 @@
Margin="7"
Padding="20,10"
HorizontalContentAlignment="Left"
- AutomationProperties.Name="{Binding Name, StringFormat='{}{0} Page'}"
+ AutomationProperties.Name="{Binding Title, StringFormat='{}{0} Page'}"
Command="{Binding ViewModel.NavigateCommand, RelativeSource={RelativeSource AncestorType={x:Type local:AllSamplesPage}}}"
CommandParameter="{Binding PageType}">
+ Margin="0,0,8,0">
+
+
+
+
+ Text="{Binding Title}" AutomationProperties.HeadingLevel="Level3" />
+ Margin="0,0,8,0">
+
+
+
+
+ Text="{Binding Title}" />
+ Margin="0,0,8,0">
+
+
+
+
-
@@ -66,20 +65,23 @@
Margin="7"
Padding="20,10"
HorizontalContentAlignment="Left"
- AutomationProperties.Name="{Binding Name}"
+ AutomationProperties.Name="{Binding Title}"
Command="{Binding ViewModel.NavigateCommand, RelativeSource={RelativeSource AncestorType={x:Type local:DashboardPage}}}"
CommandParameter="{Binding PageType}">
+ Margin="0,0,8,0">
+
+
+
+
+ Text="{Binding Title}" AutomationProperties.HeadingLevel="Level3" />
+ Margin="0,0,8,0">
+
+
+
+
+ Margin="0,0,8,0">
+
+
+
+
+ Text="{Binding Title}" AutomationProperties.HeadingLevel="Level2" />
+ Margin="0,0,8,0">
+
+
+
+
+ Margin="0,0,8,0">
+
+
+
+
+ Text="{Binding Title}" />
-