Skip to content

Commit c51692d

Browse files
[ WPF Gallery ] Added ControlsInfoData.json for providing support for 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]>
1 parent bd01d0e commit c51692d

35 files changed

+548
-773
lines changed

Sample Applications/WPFGallery/App.xaml.cs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using WPFGallery.Navigation;
77
using WPFGallery.ViewModels;
88
using WPFGallery.Views;
9-
using WPFGallery.Views.Samples;
109
using WPFGallery.ViewModels.Samples;
1110

1211
namespace WPFGallery;

Sample Applications/WPFGallery/MainWindow.xaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
PreviewKeyDown="ControlsList_PreviewKeyDown"
221221
PreviewMouseLeftButtonUp="ControlsList_PreviewMouseLeftButtonUp">
222222
<TreeView.ItemTemplate>
223-
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
223+
<HierarchicalDataTemplate ItemsSource="{Binding Items}">
224224
<Grid MinHeight="30">
225225
<Grid.ColumnDefinitions>
226226
<ColumnDefinition Width="Auto" />
@@ -230,16 +230,16 @@
230230
<TextBlock
231231
MaxWidth="16"
232232
VerticalAlignment="Center"
233-
AutomationProperties.Name="{Binding Name, StringFormat='{}{0} Page'}"
233+
AutomationProperties.Name="{Binding Title, StringFormat='{}{0} Page'}"
234234
Focusable="False"
235235
FontFamily="Segoe Fluent Icons"
236236
FontSize="16"
237-
Text="{Binding Icon}"
238-
Visibility="{Binding Icon, Converter={StaticResource EmptyToVisibilityConverter}}" />
237+
Text="{Binding IconGlyph}"
238+
Visibility="{Binding IconGlyph, Converter={StaticResource EmptyToVisibilityConverter}}" />
239239
<TextBlock
240240
Grid.Column="2"
241241
VerticalAlignment="Center"
242-
Text="{Binding Name}" />
242+
Text="{Binding Title}" />
243243
</Grid>
244244
</HierarchicalDataTemplate>
245245
</TreeView.ItemTemplate>

Sample Applications/WPFGallery/MainWindow.xaml.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows.Shell;
66
using WPFGallery.Navigation;
77
using WPFGallery.ViewModels;
8+
using WPFGallery.Models;
89
using WPFGallery.Views;
910

1011
namespace WPFGallery;
@@ -82,7 +83,7 @@ private void MainWindow_StateChanged(object sender, EventArgs e)
8283

8384
private void ControlsList_SelectedItemChanged()
8485
{
85-
if (ControlsList.SelectedItem is NavigationItem navItem)
86+
if (ControlsList.SelectedItem is ControlInfoDataItem navItem)
8687
{
8788
_navigationService.Navigate(navItem.PageType);
8889
var tvi = ControlsList.ItemContainerGenerator.ContainerFromItem(navItem) as TreeViewItem;
@@ -167,13 +168,13 @@ private void CloseWindow(object sender, RoutedEventArgs e)
167168

168169
private void OnNavigating(object? sender, NavigatingEventArgs e)
169170
{
170-
List<NavigationItem> list = ViewModel.GetNavigationItemHierarchyFromPageType(e.PageType);
171+
List<ControlInfoDataItem> list = ViewModel.GetNavigationItemHierarchyFromPageType(e.PageType);
171172

172173
if (list.Count > 0)
173174
{
174175
TreeViewItem selectedTreeViewItem = null;
175176
ItemsControl itemsControl = ControlsList;
176-
foreach(NavigationItem item in list)
177+
foreach(ControlInfoDataItem item in list)
177178
{
178179
var tvi = itemsControl.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
179180
if(tvi != null)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
[
2+
{
3+
"UniqueId": "Home",
4+
"Title": "Home",
5+
"PageName": "DashboardPage",
6+
"IconGlyph": "\uE80F"
7+
},
8+
{
9+
"UniqueId": "Design Guidance",
10+
"Title": "Design Guidance",
11+
"PageName": "DesignGuidancePage",
12+
"IconGlyph": "\uEB3C",
13+
"IsGroup": true,
14+
"Items": [
15+
{
16+
"UniqueId": "Colors",
17+
"Title": "Colors",
18+
"PageName": "ColorsPage",
19+
"IconGlyph": "\uE790",
20+
"Description": "Guide showing how to use colors in your app.",
21+
"ImagePath": "Assets/ControlImages/ColorPaletteResources.png"
22+
},
23+
{
24+
"UniqueId": "Typography",
25+
"Title": "Typography",
26+
"PageName": "TypographyPage",
27+
"IconGlyph": "\uE8D2",
28+
"Description": "Guide showing how to use typography in your app.",
29+
"ImagePath": "Assets/ControlImages/TextBlock.png"
30+
},
31+
{
32+
"UniqueId": "Icons",
33+
"Title": "Icons",
34+
"PageName": "IconsPage",
35+
"IconGlyph": "\uED58",
36+
"Description": "Guide showing how to use icons in your app.",
37+
"ImagePath": "Assets/ControlImages/IconElement.png"
38+
}
39+
]
40+
},
41+
{
42+
"UniqueId": "Samples",
43+
"Title": "Samples",
44+
"PageName": "SamplesPage",
45+
"IconGlyph": "\uEF58",
46+
"IsGroup": true,
47+
"Items": [
48+
{
49+
"UniqueId": "User Dashboard",
50+
"Title": "User Dashboard",
51+
"PageName": "UserDashboardPage",
52+
"Description": "A dashboard for a user to view and interact with.",
53+
"ImagePath": "Assets/ControlImages/PersonPicture.png"
54+
}
55+
]
56+
},
57+
{
58+
"UniqueId": "All Controls",
59+
"Title": "All Controls",
60+
"PageName": "AllSamplesPage",
61+
"IconGlyph": "\uE71D"
62+
},
63+
{
64+
"UniqueId": "Basic Input",
65+
"Title": "Basic Input",
66+
"PageName": "BasicInputPage",
67+
"IconGlyph": "\uE73A",
68+
"Description": "Button, CheckBox, ComboBox, RadioButton, Slider.",
69+
"ImagePath": "Assets/ControlImages/Button.png",
70+
"IsGroup": true,
71+
"Items": [
72+
{
73+
"UniqueId": "Button",
74+
"Title": "Button",
75+
"PageName": "ButtonPage",
76+
"ImagePath": "Assets/ControlImages/Button.png",
77+
"Description": "A control that responds to user input and raises a Click event."
78+
},
79+
{
80+
"UniqueId": "CheckBox",
81+
"Title": "CheckBox",
82+
"PageName": "CheckBoxPage",
83+
"ImagePath": "Assets/ControlImages/CheckBox.png",
84+
"Description": "A control that a user can select or clear."
85+
},
86+
{
87+
"UniqueId": "ComboBox",
88+
"Title": "ComboBox",
89+
"PageName": "ComboBoxPage",
90+
"ImagePath": "Assets/ControlImages/CheckBox.png",
91+
"Description": "A drop-down list of items a user can select from."
92+
},
93+
{
94+
"UniqueId": "RadioButton",
95+
"Title": "RadioButton",
96+
"PageName": "RadioButtonPage",
97+
"ImagePath": "Assets/ControlImages/RadioButton.png",
98+
"Description": "A control that allows a user to select a single option from a group of options."
99+
},
100+
{
101+
"UniqueId": "Slider",
102+
"Title": "Slider",
103+
"PageName": "SliderPage",
104+
"ImagePath": "Assets/ControlImages/Slider.png",
105+
"Description": "A control that lets the user select from a range of values by moving a Thumb control along a track."
106+
}
107+
]
108+
},
109+
{
110+
"UniqueId": "Collections",
111+
"Title": "Collections",
112+
"PageName": "CollectionsPage",
113+
"IconGlyph": "\uE80A",
114+
"Description": "DataGrid, ListBox, ListView, TreeView.",
115+
"ImagePath": "Assets/ControlImages/DataGrid.png",
116+
"IsGroup": true,
117+
"Items": [
118+
{
119+
"UniqueId": "DataGrid",
120+
"Title": "DataGrid",
121+
"PageName": "DataGridPage",
122+
"ImagePath": "Assets/ControlImages/DataGrid.png",
123+
"Description": "The DataGrid control presents data in a customizable table of rows and columns."
124+
},
125+
{
126+
"UniqueId": "ListBox",
127+
"Title": "ListBox",
128+
"PageName": "ListBoxPage",
129+
"ImagePath": "Assets/ControlImages/Listbox.png",
130+
"Description": "A control that presents an inline list of items that the user can select from."
131+
},
132+
{
133+
"UniqueId": "ListView",
134+
"Title": "ListView",
135+
"PageName": "ListViewPage",
136+
"ImagePath": "Assets/ControlImages/ListView.png",
137+
"Description": "A control that presents a collection of items in a vertical list."
138+
},
139+
{
140+
"UniqueId": "TreeView",
141+
"Title": "TreeView",
142+
"PageName": "TreeViewPage",
143+
"ImagePath": "Assets/ControlImages/TreeView.png",
144+
"Description": "The TreeView control is a hierarchical list pattern with expanding and collapsing nodes that contain nested items."
145+
}
146+
]
147+
},
148+
{
149+
"UniqueId": "Date & Calendar",
150+
"Title": "Date & Calendar",
151+
"PageName": "DateAndTimePage",
152+
"IconGlyph": "\uEC92",
153+
"Description": "Calendar, DatePicker.",
154+
"ImagePath": "Assets/ControlImages/CalendarView.png",
155+
"IsGroup": true,
156+
"Items": [
157+
{
158+
"UniqueId": "Calendar",
159+
"Title": "Calendar",
160+
"PageName": "CalendarPage",
161+
"ImagePath": "Assets/ControlImages/CalendarView.png",
162+
"Description": "A control that presents a calendar for a user to choose a date from."
163+
},
164+
{
165+
"UniqueId": "DatePicker",
166+
"Title": "DatePicker",
167+
"PageName": "DatePickerPage",
168+
"ImagePath": "Assets/ControlImages/DatePicker.png",
169+
"Description": "A control that lets a user pick a date value."
170+
}
171+
]
172+
},
173+
{
174+
"UniqueId": "Layout",
175+
"Title": "Layout",
176+
"PageName": "LayoutPage",
177+
"IconGlyph": "\uF246",
178+
"Description": "Expander",
179+
"ImagePath": "Assets/ControlImages/Expander.png",
180+
"IsGroup": true,
181+
"Items": [
182+
{
183+
"UniqueId": "Expander",
184+
"Title": "Expander",
185+
"PageName": "ExpanderPage",
186+
"ImagePath": "Assets/ControlImages/Expander.png",
187+
"Description": "A container with a header that can be expanded to show a body with more content."
188+
}
189+
]
190+
},
191+
{
192+
"UniqueId": "Navigation",
193+
"Title": "Navigation",
194+
"PageName": "NavigationPage",
195+
"IconGlyph": "\uE700",
196+
"Description": "Menu, TabControl.",
197+
"ImagePath": "Assets/ControlImages/Pivot.png",
198+
"IsGroup": true,
199+
"Items": [
200+
{
201+
"UniqueId": "Menu",
202+
"Title": "Menu",
203+
"PageName": "MenuPage",
204+
"ImagePath": "Assets/ControlImages/Pivot.png",
205+
"Description": "A classic menu, allowing the display of MenuItems containing MenuFlyoutItems."
206+
},
207+
{
208+
"UniqueId": "TabControl",
209+
"Title": "TabControl",
210+
"PageName": "TabControlPage",
211+
"ImagePath": "Assets/ControlImages/TabView.png",
212+
"Description": "A control that displays a collection of tabs."
213+
}
214+
]
215+
},
216+
{
217+
"UniqueId": "Status & Info",
218+
"Title": "Status & Info",
219+
"PageName": "StatusAndInfoPage",
220+
"IconGlyph": "\uE8F2",
221+
"Description": "ProgressBar, ToolTip.",
222+
"ImagePath": "Assets/ControlImages/ProgressBar.png",
223+
"IsGroup": true,
224+
"Items": [
225+
{
226+
"UniqueId": "ProgressBar",
227+
"Title": "ProgressBar",
228+
"PageName": "ProgressBarPage",
229+
"ImagePath": "Assets/ControlImages/ProgressBar.png",
230+
"Description": "Shows the apps progress on a task, or that the app is performing ongoing work that doesn't block user interaction."
231+
},
232+
{
233+
"UniqueId": "ToolTip",
234+
"Title": "ToolTip",
235+
"PageName": "ToolTipPage",
236+
"ImagePath": "Assets/ControlImages/ToolTip.png",
237+
"Description": "Displays information for an element in a pop-up window."
238+
}
239+
]
240+
},
241+
{
242+
"UniqueId": "Text",
243+
"Title": "Text",
244+
"PageName": "TextPage",
245+
"IconGlyph": "\uE8D2",
246+
"Description": "Label, TextBox, TextBlock, RichTextEdit, PasswordBox.",
247+
"ImagePath": "Assets/ControlImages/TextBlock.png",
248+
"IsGroup": true,
249+
"Items": [
250+
{
251+
"UniqueId": "Label",
252+
"Title": "Label",
253+
"PageName": "LabelPage",
254+
"ImagePath": "Assets/ControlImages/Button.png",
255+
"Description": "Caption of an item."
256+
},
257+
{
258+
"UniqueId": "TextBox",
259+
"Title": "TextBox",
260+
"PageName": "TextBoxPage",
261+
"ImagePath": "Assets/ControlImages/TextBox.png",
262+
"Description": "A single-line or multi-line plain text field."
263+
},
264+
{
265+
"UniqueId": "TextBlock",
266+
"Title": "TextBlock",
267+
"PageName": "TextBlockPage",
268+
"ImagePath": "Assets/ControlImages/TextBlock.png",
269+
"Description": "A lightweight control for displaying small amounts of text."
270+
},
271+
{
272+
"UniqueId": "RichTextEdit",
273+
"Title": "RichTextEdit",
274+
"PageName": "RichTextEditPage",
275+
"ImagePath": "Assets/ControlImages/RichEditBox.png",
276+
"Description": "A control that displays formatted text, hyperlinks, inline images, and other rich content."
277+
},
278+
{
279+
"UniqueId": "PasswordBox",
280+
"Title": "PasswordBox",
281+
"PageName": "PasswordBoxPage",
282+
"ImagePath": "Assets/ControlImages/PasswordBox.png",
283+
"Description": "A control for entering passwords."
284+
}
285+
]
286+
}
287+
]

0 commit comments

Comments
 (0)