Skip to content

Commit 0197137

Browse files
Added heat map calendar demo
1 parent ec915d4 commit 0197137

21 files changed

Lines changed: 459 additions & 0 deletions

HeatMap/SchedulerHeatMap/App.xaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Application
2+
x:Class="SchedulerHeatMap.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:SchedulerHeatMap">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
10+
<!-- Other merged dictionaries here -->
11+
</ResourceDictionary.MergedDictionaries>
12+
<!-- Other app resources here -->
13+
</ResourceDictionary>
14+
</Application.Resources>
15+
</Application>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using Microsoft.UI.Xaml;
2+
using Microsoft.UI.Xaml.Controls;
3+
using Microsoft.UI.Xaml.Controls.Primitives;
4+
using Microsoft.UI.Xaml.Data;
5+
using Microsoft.UI.Xaml.Input;
6+
using Microsoft.UI.Xaml.Media;
7+
using Microsoft.UI.Xaml.Navigation;
8+
using Microsoft.UI.Xaml.Shapes;
9+
using System;
10+
using System.Collections.Generic;
11+
using System.IO;
12+
using System.Linq;
13+
using System.Runtime.InteropServices.WindowsRuntime;
14+
using Windows.ApplicationModel;
15+
using Windows.ApplicationModel.Activation;
16+
using Windows.Foundation;
17+
using Windows.Foundation.Collections;
18+
19+
// To learn more about WinUI, the WinUI project structure,
20+
// and more about our project templates, see: http://aka.ms/winui-project-info.
21+
22+
namespace SchedulerHeatMap
23+
{
24+
/// <summary>
25+
/// Provides application-specific behavior to supplement the default Application class.
26+
/// </summary>
27+
public partial class App : Application
28+
{
29+
/// <summary>
30+
/// Initializes the singleton application object. This is the first line of authored code
31+
/// executed, and as such is the logical equivalent of main() or WinMain().
32+
/// </summary>
33+
public App()
34+
{
35+
this.InitializeComponent();
36+
}
37+
38+
/// <summary>
39+
/// Invoked when the application is launched normally by the end user. Other entry points
40+
/// will be used such as when the application is launched to open a specific file.
41+
/// </summary>
42+
/// <param name="args">Details about the launch request and process.</param>
43+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
44+
{
45+
m_window = new MainWindow();
46+
m_window.Activate();
47+
}
48+
49+
private Window m_window;
50+
}
51+
}
432 Bytes
Loading
5.25 KB
Loading
1.71 KB
Loading
637 Bytes
Loading
283 Bytes
Loading
456 Bytes
Loading
2.05 KB
Loading
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using Microsoft.UI;
2+
using Microsoft.UI.Xaml;
3+
using Microsoft.UI.Xaml.Controls;
4+
using Microsoft.UI.Xaml.Media;
5+
using Syncfusion.UI.Xaml.Scheduler;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
12+
namespace SchedulerHeatMap
13+
{
14+
public class MonthCellTemplateSelector : DataTemplateSelector
15+
{
16+
public DataTemplate LightGray { get; set; }
17+
public DataTemplate LightGreen { get; set; }
18+
public DataTemplate MidGreen { get; set; }
19+
public DataTemplate Green { get; set; }
20+
public DataTemplate DarkGreen { get; set; }
21+
22+
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
23+
{
24+
var date = (container as MonthCell).DateTime;
25+
if (date.Month % 2 == 0)
26+
{
27+
if (date.Day % 6 == 0)
28+
{
29+
// 6, 12, 18, 24, 30
30+
return DarkGreen;
31+
}
32+
else if (date.Day % 5 == 0)
33+
{
34+
// 5, 10, 15, 20, 25
35+
return MidGreen;
36+
}
37+
else if (date.Day % 8 == 0 || date.Day % 4 == 0)
38+
{
39+
// 4, 8, 16, 24, 28
40+
return Green;
41+
}
42+
else if (date.Day % 9 == 0 || date.Day % 3 == 0)
43+
{
44+
// 3, 9, 18, 21, 27
45+
return LightGray;
46+
}
47+
else
48+
{
49+
// 1, 2, 7, 11, 13, 19, 22, 23, 26, 29
50+
return LightGreen;
51+
}
52+
}
53+
else
54+
{
55+
if (date.Day % 6 == 0)
56+
{
57+
// 6, 12, 18, 24, 30
58+
return LightGray;
59+
}
60+
else if (date.Day % 5 == 0)
61+
{
62+
// 5, 10, 15, 20, 25
63+
return LightGreen;
64+
}
65+
else if (date.Day % 8 == 0 || date.Day % 4 == 0)
66+
{
67+
// 4, 8, 16, 24, 28
68+
return MidGreen;
69+
}
70+
else if (date.Day % 9 == 0 || date.Day % 3 == 0)
71+
{
72+
// 3, 9, 18, 21, 27
73+
return Green;
74+
}
75+
else
76+
{
77+
// 1, 2, 7, 11, 13, 19, 22, 23, 26, 29
78+
return DarkGreen;
79+
}
80+
}
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)