-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathNavigationItemTemplateSelector.cs
62 lines (59 loc) · 2.08 KB
/
NavigationItemTemplateSelector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#region Copyright Syncfusion® Inc. 2001-2025.
// Copyright Syncfusion® Inc. 2001-2025. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
namespace Syncfusion.DemosCommon.WinUI
{
/// <summary>
/// Represent a template selector class for navigation item
/// </summary>
public class NavigationItemTemplateSelector : DataTemplateSelector
{
/// <summary>
/// Gets or sets a value of header template to display the control name.
/// </summary>
public DataTemplate HeaderTemplate { get; set; }
public DataTemplate ControlItemTemplate { get; set; }
public DataTemplate DemoItemTemplate { get; set; }
public DataTemplate CategoryItemTemplate { get; set; }
/// <summary>
/// Gets or sets a value of AllControlsButtonTemplate to display the All Controls Button.
/// </summary>
public DataTemplate AllControlsButtonTemplate { get; set; }
/// <summary>
/// A method to select the navigation item template.
/// </summary>
/// <param name="item">Browser model</param>
/// <returns>Data template</returns>
protected override DataTemplate SelectTemplateCore(object item)
{
if(item is ControlInfo)
{
return ControlItemTemplate;
}
if(item is DemoInfo)
{
return DemoItemTemplate;
}
if(item is CategoryGroup)
{
return CategoryItemTemplate;
}
if (item is BrowserModel model)
{
return HeaderTemplate;
}
if (item is AllControlsButtonInfo)
{
return AllControlsButtonTemplate;
}
throw new NotImplementedException();
}
}
}