Skip to content

Commit f5c4dee

Browse files
committed
Prepared UG samples for Blazor DateTimePicker and Dialog components
1 parent 809e3fe commit f5c4dee

File tree

140 files changed

+5336
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+5336
-0
lines changed

DateTimePicker/Client/App.razor

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.8" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.8" PrivateAssets="all" />
12+
<PackageReference Include="Syncfusion.Blazor.Calendars" Version="20.2.0.49" />
13+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="20.2.0.49" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\Shared\DateTimePickerUGSample.Shared.csproj" />
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/CalendarNavigation"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
5+
<SfDateTimePicker TValue="DateTime?" @onkeypress="@(e => KeyPressed(e))" @ref="DateTimeObj"></SfDateTimePicker>
6+
7+
@code {
8+
public SfDateTimePicker<DateTime?> DateTimeObj;
9+
public void KeyPressed(KeyboardEventArgs args)
10+
{
11+
if (args.Key == "t")
12+
{
13+
this.DateTimeObj.FocusOutAsync();
14+
}
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p role="status">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
private int currentCount = 0;
13+
14+
private void IncrementCount()
15+
{
16+
currentCount++;
17+
}
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<table>
2+
<tr>
3+
<td><a href="OneWayBinding">OneWayBinding</a></td>
4+
<td><a href="TwoWayBinding">TwoWayBinding</a></td>
5+
<td><a href="DynamicValueBinding">DynamicValueBinding</a></td>
6+
</tr>
7+
</table>
8+
9+
10+
<style>
11+
a {
12+
padding-right: 75px;
13+
}
14+
</style>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@page "/DynamicValueBinding"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
<BindingRoute></BindingRoute>
5+
6+
<p>DateTimePicker value is: @DateValue</p>
7+
8+
<SfDateTimePicker TValue="DateTime?" Value="@DateValue">
9+
<DateTimePickerEvents TValue="DateTime?" ValueChange="@onChange">
10+
</DateTimePickerEvents>
11+
</SfDateTimePicker>
12+
13+
@code {
14+
15+
public DateTime? DateValue { get; set; } = DateTime.Now;
16+
17+
private void onChange(Syncfusion.Blazor.Calendars.ChangedEventArgs<DateTime?> args)
18+
{
19+
DateValue = args.Value;
20+
StateHasChanged();
21+
}
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@page "/OneWayBinding"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
<BindingRoute></BindingRoute>
5+
6+
<SfDateTimePicker TValue="DateTime?" Value="@DateValue"></SfDateTimePicker>
7+
8+
<button @onclick="@UpdateValue">Update Value</button>
9+
10+
@code {
11+
public DateTime? DateValue { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28);
12+
13+
public void UpdateValue()
14+
{
15+
DateValue = DateTime.Now;
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@page "/TwoWayBinding"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
<BindingRoute></BindingRoute>
5+
6+
<p>DateTimePicker value is: @DateValue</p>
7+
8+
<SfDateTimePicker TValue="DateTime?" @bind-Value="@DateValue"></SfDateTimePicker>
9+
10+
@code {
11+
public DateTime? DateValue { get; set; } = DateTime.Now;
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@page "/Range"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
5+
<SfDateTimePicker TValue="DateTime?" Min='@MinDateTime' Max='@MaxDateTime' Value='@DateTimeValue'></SfDateTimePicker>
6+
7+
@code {
8+
public DateTime MinDateTime { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 7, 0, 0, 0);
9+
public DateTime MaxDateTime { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 27, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
10+
public DateTime? DateTimeValue { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 14, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/Blur"
2+
3+
@using Syncfusion.Blazor.Calendars
4+
<EventRoute></EventRoute>
5+
6+
<SfDateTimePicker TValue="DateTime?">
7+
<DateTimePickerEvents TValue="DateTime?" Blur="BlurHandler"></DateTimePickerEvents>
8+
</SfDateTimePicker>
9+
10+
@code {
11+
12+
public void BlurHandler(Syncfusion.Blazor.Calendars.BlurEventArgs args)
13+
{
14+
// Here, you can customize your code.
15+
}
16+
}

0 commit comments

Comments
 (0)