Skip to content

Commit 69fe54d

Browse files
NavigationRail, NavigationBar, NavigationDrawer controls for MaterialDesign3 (#2628)
* Test Material Design 3 Listbox * Update Material Design 3 Navigation Rail * Fix Shadow bug in Drawer Fix a bug where the shadow would remain in Standard OpenMode * Add NavigationRail, NavigationBar, NavigationDrawer * Add NavigationRail and NavigationBar pages * Showcase new Navigation controls in DemoApp Change the layout and navigation to use the new Navigation controls * Update MaterialDesign3.Demo.Wpf/Domain/SampleItem.cs Co-authored-by: Kevin B <[email protected]> * Change style names And add FAB to Drawer * Add XamlDisplay * Add new Badged Style * Add badge to navigation controls * Add badge examples * Fix nullable warning Co-authored-by: Kevin B <[email protected]>
1 parent 39a9ca5 commit 69fe54d

24 files changed

+2169
-758
lines changed

MaterialDesign3.Demo.Wpf/Domain/DemoItem.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Windows;
44
using System.Windows.Controls;
5+
using MaterialDesignThemes.Wpf;
56

67
namespace MaterialDesign3Demo.Domain
78
{
@@ -15,12 +16,17 @@ public class DemoItem : ViewModelBase
1516
private ScrollBarVisibility _verticalScrollBarVisibilityRequirement = ScrollBarVisibility.Auto;
1617
private Thickness _marginRequirement = new(16);
1718

18-
public DemoItem(string name, Type contentType, IEnumerable<DocumentationLink> documentation, object? dataContext = null)
19+
private int _notificationNumber = 0;
20+
21+
public DemoItem(string name, Type contentType, IEnumerable<DocumentationLink> documentation,
22+
PackIconKind selectedIcon, PackIconKind unselectedIcon, object? dataContext = null)
1923
{
2024
Name = name;
2125
_contentType = contentType;
2226
_dataContext = dataContext;
2327
Documentation = documentation;
28+
SelectedIcon = selectedIcon;
29+
UnselectedIcon = unselectedIcon;
2430
}
2531

2632
public string Name { get; }
@@ -29,6 +35,18 @@ public DemoItem(string name, Type contentType, IEnumerable<DocumentationLink> do
2935

3036
public object? Content => _content ??= CreateContent();
3137

38+
public PackIconKind SelectedIcon { get; set; }
39+
public PackIconKind UnselectedIcon { get; set; }
40+
41+
public object? Notifications
42+
{
43+
get
44+
{
45+
if (_notificationNumber == 0) return null;
46+
else return _notificationNumber < 100 ? _notificationNumber : "99+";
47+
}
48+
}
49+
3250
public ScrollBarVisibility HorizontalScrollBarVisibilityRequirement
3351
{
3452
get => _horizontalScrollBarVisibilityRequirement;
@@ -57,5 +75,17 @@ public Thickness MarginRequirement
5775

5876
return content;
5977
}
78+
79+
public void AddNewNotification()
80+
{
81+
_notificationNumber++;
82+
OnPropertyChanged(nameof(Notifications));
83+
}
84+
85+
public void DismissAllNotifications()
86+
{
87+
_notificationNumber = 0;
88+
OnPropertyChanged(nameof(Notifications));
89+
}
6090
}
6191
}

0 commit comments

Comments
 (0)