Skip to content

Commit c82c875

Browse files
Merge pull request #2 from Niranjan16-Ninja/master
SfSchedule sample has been updated successfully.
2 parents d112b99 + e03a471 commit c82c875

File tree

13 files changed

+600
-0
lines changed

13 files changed

+600
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
5+
</startup>
6+
</configuration>

SfSchedule_CustomGrouping/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="SfSchedule_CustomGrouping.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:SfSchedule_CustomGrouping"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace SfSchedule_CustomGrouping
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Window
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:SfSchedule_CustomGrouping"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="SfSchedule_CustomGrouping.MainWindow"
8+
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
9+
Title="MainWindow" Height="550" Width="900">
10+
<Grid Background="GhostWhite">
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="auto" ></RowDefinition>
13+
<RowDefinition></RowDefinition>
14+
</Grid.RowDefinitions>
15+
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center">
16+
<Button x:Name="television" Content="Television" Click="Button_Click_1" Height="30" Margin="5" Foreground="Black" Background="#FF25A0DA" Width="200" HorizontalAlignment="Center" />
17+
<Button x:Name="programs" Width="200" Click="Button_Click_1" Height="30" Margin="5" Foreground="Black" Background="#FF25A0DA" Content="Programs" HorizontalAlignment="Center"/>
18+
</StackPanel>
19+
<syncfusion:SfSchedule Grid.Column="0" ScheduleType="Week" DayHeaderOrder="OrderByDate"
20+
IntervalHeight="30" Background="WhiteSmoke" Appointments="{Binding FilterColl}" Resource="TV" CurrentDateBackground="#63A028" HeaderBackground="#FF25A0DA" x:Name="schedule" Grid.Row="1" >
21+
<syncfusion:SfSchedule.ScheduleResourceTypeCollection>
22+
<syncfusion:ResourceType TypeName="TV" >
23+
<syncfusion:Resource ResourceName="TV1" DisplayName="StarSports" />
24+
<syncfusion:Resource ResourceName="TV2" DisplayName="ESPN"/>
25+
<syncfusion:Resource ResourceName="TV3" DisplayName="TenSports"/>
26+
</syncfusion:ResourceType>
27+
<syncfusion:ResourceType TypeName="programs">
28+
<syncfusion:Resource ResourceName="FootBall" DisplayName="FootBall"/>
29+
<syncfusion:Resource ResourceName="Cricket" DisplayName="Cricket"/>
30+
<syncfusion:Resource ResourceName="News" DisplayName="News"/>
31+
</syncfusion:ResourceType>
32+
</syncfusion:SfSchedule.ScheduleResourceTypeCollection>
33+
</syncfusion:SfSchedule>
34+
</Grid>
35+
</Window>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using Syncfusion.UI.Xaml.Schedule;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Collections.ObjectModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using System.Windows;
9+
using System.Windows.Controls;
10+
using System.Windows.Data;
11+
using System.Windows.Documents;
12+
using System.Windows.Input;
13+
using System.Windows.Media;
14+
using System.Windows.Media.Imaging;
15+
using System.Windows.Navigation;
16+
using System.Windows.Shapes;
17+
18+
namespace SfSchedule_CustomGrouping
19+
{
20+
/// <summary>
21+
/// Interaction logic for MainWindow.xaml
22+
/// </summary>
23+
public partial class MainWindow : Window
24+
{
25+
private ObservableCollection<DateTime> datecoll = new ObservableCollection<DateTime>();
26+
private ObservableCollection<DateTime> dateselected = new ObservableCollection<DateTime>();
27+
public ScheduleAppointmentCollection FilterColl { get; set; }
28+
Random random;
29+
public MainWindow()
30+
{
31+
this.InitializeComponent();
32+
33+
television.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
34+
random = new Random();
35+
for (int i = -20; i < 20; i += 2)
36+
{
37+
for (int j = -7; j < 7; j++)
38+
{
39+
datecoll.Add(DateTime.Now.Date.AddDays(j).AddHours(i));
40+
}
41+
}
42+
this.FilterColl = GetFilterCollection();
43+
this.DataContext = this;
44+
}
45+
private ScheduleAppointmentCollection GetFilterCollection()
46+
{
47+
string[] football = new string[] { "USA vs IRN ", "RUS vs ARG", "POR vs SWI", "BEL vs ARG", "USA vs RUS", "IRN vs POR", "CRO vs MEX", "JPN vs ITA", "COL vs URU" };
48+
string[] cricket = new string[] { "IND vs PAk", "AUS vs SA", "SRI vs WI", "SA vs IND", "ZIM vs PAK", "SRI vs AUS" };
49+
string[] news = new string[] { "Cricket news", "Football news", "Hockey news", "Tennis news", "news of Athletics", "Golf news", "Kabaddi news", "VolleyBall news" };
50+
string[] pgms = new string[] { "FootBall", "Cricket", "News" };
51+
ScheduleAppointmentCollection app = new ScheduleAppointmentCollection();
52+
for (int dc = 0; dc < datecoll.Count - 1; dc++)
53+
{
54+
DateTime date = datecoll[dc];
55+
dateselected.Add(date);
56+
57+
for (int sd = 0; sd < dateselected.Count - 1; sd++)
58+
{
59+
if (date == dateselected[sd])
60+
{
61+
date = date.AddDays(1);
62+
}
63+
}
64+
ScheduleAppointment app1 = new ScheduleAppointment() { StartTime = date };
65+
app1.ResourceCollection.Add(new Resource() { ResourceName = "TV" + random.Next(1, 4), TypeName = "TV" });
66+
app1.ResourceCollection.Add(new Resource() { ResourceName = pgms[random.Next(0, 3)], TypeName = "programs" });
67+
if ((app1.ResourceCollection[1] as Resource).ResourceName.Equals("FootBall"))
68+
{
69+
app1.Subject = football[random.Next(0, football.Length)];
70+
app1.EndTime = date.AddHours(1);
71+
}
72+
else if ((app1.ResourceCollection[1] as Resource).ResourceName.Equals("Cricket"))
73+
{
74+
app1.Subject = cricket[random.Next(0, cricket.Length)];
75+
app1.EndTime = date.AddHours(1);
76+
}
77+
else
78+
{
79+
app1.Subject = news[random.Next(0, news.Length)];
80+
app1.EndTime = date.AddHours(1);
81+
}
82+
app1.AppointmentBackground = new SolidColorBrush(Colors.DimGray);
83+
84+
app.Add(app1);
85+
}
86+
return app;
87+
}
88+
private void Button_Click_1(object sender, RoutedEventArgs e)
89+
{
90+
string str = (sender as Button).Content.ToString();
91+
if (str.Equals("Television"))
92+
{
93+
programs.IsEnabled = true;
94+
this.schedule.Resource = "TV";
95+
television.IsEnabled = false;
96+
}
97+
else
98+
{
99+
television.IsEnabled = true;
100+
this.schedule.Resource = "programs";
101+
programs.IsEnabled = false;
102+
}
103+
}
104+
105+
}
106+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[assembly: AssemblyTitle("SfSchedule_CustomGrouping")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("SfSchedule_CustomGrouping")]
15+
[assembly: AssemblyCopyright("Copyright © 2020")]
16+
[assembly: AssemblyTrademark("")]
17+
[assembly: AssemblyCulture("")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
//In order to begin building localizable applications, set
25+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
26+
//inside a <PropertyGroup>. For example, if you are using US english
27+
//in your source files, set the <UICulture> to en-US. Then uncomment
28+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
29+
//the line below to match the UICulture setting in the project file.
30+
31+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32+
33+
34+
[assembly: ThemeInfo(
35+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36+
//(used if a resource is not found in the page,
37+
// or application resource dictionaries)
38+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39+
//(used if a resource is not found in the page,
40+
// app, or any theme specific resource dictionaries)
41+
)]
42+
43+
44+
// Version information for an assembly consists of the following four values:
45+
//
46+
// Major Version
47+
// Minor Version
48+
// Build Number
49+
// Revision
50+
//
51+
// You can specify all the values or you can default the Build and Revision Numbers
52+
// by using the '*' as shown below:
53+
// [assembly: AssemblyVersion("1.0.*")]
54+
[assembly: AssemblyVersion("1.0.0.0")]
55+
[assembly: AssemblyFileVersion("1.0.0.0")]

SfSchedule_CustomGrouping/Properties/Resources.Designer.cs

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)