This commit is contained in:
SyncfusionBuild 2021-11-12 16:03:57 +05:30
Родитель 4930ed191f
Коммит ac7517926d
1516 изменённых файлов: 88500 добавлений и 1 удалений

Просмотреть файл

@ -191,4 +191,4 @@ Syncfusion has no liability for any damage or consequence that may arise by the
* Contact our sales team at <salessupport@syncfusion.com>.
<p>Copyright © 2001-2021 Syncfusion, Inc. Updated on 2021-11-12 at precisely 16:03:02 EST.</p>
<p>Copyright © 2001-2021 Syncfusion, Inc. Updated on 2021-11-12 at precisely 16:03:56 EST.</p>

15
barcode/App.xaml Normal file
Просмотреть файл

@ -0,0 +1,15 @@
<Application
x:Class="syncfusion.barcodedemos.winui.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:syncfusion.barcodedemos.winui">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

160
barcode/App.xaml.cs Normal file
Просмотреть файл

@ -0,0 +1,160 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.ApplicationModel.Core;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace syncfusion.barcodedemos.winui
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
#if !WinUI_Desktop
this.Suspending += OnSuspending;
#endif
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
{
#if WinUI_Desktop
m_window = new MainWindow();
m_window.Activate();
Frame rootFrame = m_window.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// rootFrame.NavigationFailed += OnNavigationFailed;
if (e != null && e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
m_window.Content = rootFrame;
}
// if (args != null && args.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
{
#pragma warning disable CA1806 // Do not ignore method results
new SamplesConfiguration();
#pragma warning restore CA1806 // Do not ignore method results
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(demoscommon.winui.MainPage), e.Arguments);
}
// Ensure the current window is active
m_window.Activate();
}
#else
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
{
new SamplesConfiguration();
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(demoscommon.winui.MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
#endif
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
#if !WinUI_Desktop
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
#else
private MainWindow m_window;
#endif
}
}

Двоичные данные
barcode/Assets/Tiles/LargeTile.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичные данные
barcode/Assets/Tiles/LargeTile.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Двоичные данные
barcode/Assets/Tiles/LargeTile.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 38 KiB

Двоичные данные
barcode/Assets/Tiles/SmallTile.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
barcode/Assets/Tiles/SmallTile.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Двоичные данные
barcode/Assets/Tiles/SmallTile.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.9 KiB

Двоичные данные
barcode/Assets/Tiles/SplashScreen.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.8 KiB

Двоичные данные
barcode/Assets/Tiles/SplashScreen.scale-125.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
barcode/Assets/Tiles/SplashScreen.scale-150.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
barcode/Assets/Tiles/SplashScreen.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 25 KiB

Двоичные данные
barcode/Assets/Tiles/SplashScreen.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 72 KiB

Двоичные данные
barcode/Assets/Tiles/Square150x150Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.4 KiB

Двоичные данные
barcode/Assets/Tiles/Square150x150Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Двоичные данные
barcode/Assets/Tiles/Square150x150Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
barcode/Assets/Tiles/Square44x44Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
barcode/Assets/Tiles/Square44x44Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.0 KiB

Двоичные данные
barcode/Assets/Tiles/Square44x44Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.3 KiB

Двоичные данные
barcode/Assets/Tiles/StoreLogo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичные данные
barcode/Assets/Tiles/StoreLogo.scale-125.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.6 KiB

Двоичные данные
barcode/Assets/Tiles/StoreLogo.scale-150.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.3 KiB

Двоичные данные
barcode/Assets/Tiles/StoreLogo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.8 KiB

Двоичные данные
barcode/Assets/Tiles/StoreLogo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
barcode/Assets/Tiles/Wide310x150Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.6 KiB

Двоичные данные
barcode/Assets/Tiles/Wide310x150Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.1 KiB

Двоичные данные
barcode/Assets/Tiles/Wide310x150Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 18 KiB

11
barcode/MainWindow.xaml Normal file
Просмотреть файл

@ -0,0 +1,11 @@
<Window
x:Class="syncfusion.barcodedemos.winui.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:syncfusion.barcodedemos.winui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Frame/>
</Window>

Просмотреть файл

@ -0,0 +1,39 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace syncfusion.barcodedemos.winui
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.Title = "Syncfusion Barcode Controls Gallery for WinUI Desktop";
}
}
}

Просмотреть файл

@ -0,0 +1,24 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace syncfusion.barcodedemos.winui
{
public class BarcodeModel
{
#region Properties
public string SymobologyItem { get; set; }
public string DataMatrixEncoding { get; set; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,36 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("syncfusion.barcodedemos.winui")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Syncfusion Inc.")]
[assembly: AssemblyProduct("syncfusion.barcodedemos.winui")]
[assembly: AssemblyCopyright("Copyright © 2001-2021 Syncfusion Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("19.3300.0.53")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -0,0 +1,31 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Просмотреть файл

@ -0,0 +1,59 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 syncfusion.demoscommon.winui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace syncfusion.barcodedemos.winui
{
public class SamplesConfiguration
{
public SamplesConfiguration()
{
// Showcase & Updated
// Showcase & New
//What's New
DemoInfo showCaseSample1 = new DemoInfo()
{
Name = "Getting Started",
Category = "Getting Started",
Description = "This sample showcases how to display data in the encoded machine-readable format using supported symbol types either in a one-dimensional or two-dimensional pattern.",
DemoType = DemoTypes.None,
DemoView = typeof(Views.BarcodeDemoPage)
};
showCaseSample1.Documentation.AddRange(new List<Documentation>()
{ new Documentation() { Content = "Barcode - API", Uri = new Uri("https://help.syncfusion.com"), } });
// Updated
var demos = new List<DemoInfo>()
{
showCaseSample1
};
var controlInfo = new ControlInfo()
{
Control = DemoControl.Barcode,
Description = "The Barcode is a data visualization control to generate and display data in a machine-readable format using supported symbol types.",
Glyph = "\uE709",
ControlBadge = ControlBadge.None,
ControlCategory = ControlCategory.DataVisualization
};
controlInfo.Demos.AddRange(demos);
DemoHelper.ControlInfos.Add(controlInfo);
}
}
}

Просмотреть файл

@ -0,0 +1,373 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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.Data;
using Syncfusion.UI.Xaml.Barcode;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
#if WinUI_Desktop
using System.ComponentModel;
#else
using System.ServiceModel.Channels;
#endif
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace syncfusion.barcodedemos.winui
{
public class BarcodeViewModel : INotifyPropertyChanged
{
#region Fields
private string code11BarcodeText = "1010111011";
private string validateCode11BarcodeText = "";
private string validateDataMatricBarcodeText = "";
private string dataMatrixSupportedChar = "[^A-Za-z0-9]";
private string dataMatrixBarcodeText = "Syncfusion";
private string qrBarcodeText = "Syncfusion";
private BarcodeModel selectedItem = new BarcodeModel();
private BarcodeBase symbologyItem = new CodabarBarcode();
private BarcodeModel encodingSelectedValue = new BarcodeModel();
private Visibility code11BarcodeVisibility = Visibility.Visible;
private Visibility dataMatrixBarcodeVisibility = Visibility.Visible;
public event PropertyChangedEventHandler PropertyChanged;
#endregion
#region Constructor
public BarcodeViewModel()
{
Symbology = new ObservableCollection<BarcodeModel>();
EncodingValues = new ObservableCollection<BarcodeModel>();
Symbology.Add(new BarcodeModel() { SymobologyItem = "CodaBar" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code11" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code32" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code39" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code39Extended" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code93" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code93Extended" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code128A" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code128B" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Code128C" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "UpcBarcode" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "GS1Code128Barcode" });
Symbology.Add(new BarcodeModel() { SymobologyItem = "Pdf417Barcode" });
EncodingValues.Add(new BarcodeModel() { DataMatrixEncoding = "Auto" });
EncodingValues.Add(new BarcodeModel() { DataMatrixEncoding = "ASCII" });
EncodingValues.Add(new BarcodeModel() { DataMatrixEncoding = "ASCIINumeric" });
EncodingValues.Add(new BarcodeModel() { DataMatrixEncoding = "Base256" });
}
#endregion
#region Properties
public ObservableCollection<BarcodeModel> Symbology { get; }
public ObservableCollection<BarcodeModel> EncodingValues { get; }
public BarcodeModel SelectedItem
{
get
{
return selectedItem;
}
set
{
selectedItem = value;
UpdateSymbology(selectedItem);
OnPropertyChanged("SelectedItem");
}
}
public BarcodeModel EncodingSelectedValue
{
get
{
return encodingSelectedValue;
}
set
{
encodingSelectedValue = value;
SelectedEncodingValue(encodingSelectedValue);
}
}
public BarcodeBase SymbologyItem
{
get
{
return symbologyItem;
}
set
{
symbologyItem = value;
OnPropertyChanged("SymbologyItem");
}
}
public string Code11BarcodeText
{
get
{
return code11BarcodeText;
}
set
{
code11BarcodeText = value;
ValidateCode11Barcode(code11BarcodeText);
OnPropertyChanged("Code11BarcodeText");
}
}
public string DataMatrixBarcodeText
{
get
{
return dataMatrixBarcodeText;
}
set
{
dataMatrixBarcodeText = value;
if (EncodingSelectedValue.DataMatrixEncoding == "ASCIINumeric")
ValidateDataMatrixText(dataMatrixBarcodeText);
OnPropertyChanged("DataMatrixBarcodeText");
}
}
public string QRBarcodeText
{
get
{
return qrBarcodeText;
}
set
{
qrBarcodeText = value;
OnPropertyChanged("QRBarcodeText");
}
}
public string ValidateCode11BarcodeText
{
get
{
return validateCode11BarcodeText;
}
set
{
validateCode11BarcodeText = value;
OnPropertyChanged("ValidateCode11BarcodeText");
}
}
public string ValidateDataMatrixBarcodeText
{
get
{
return validateDataMatricBarcodeText;
}
set
{
validateDataMatricBarcodeText = value;
OnPropertyChanged("ValidateDataMatrixBarcodeText");
}
}
public string DataMatrixSupportedChar
{
get
{
return dataMatrixSupportedChar;
}
set
{
dataMatrixSupportedChar = value;
OnPropertyChanged("DataMatrixSupportedChar");
}
}
public Visibility Code11BarcodeVisibility
{
get
{
return code11BarcodeVisibility;
}
set
{
code11BarcodeVisibility = value;
OnPropertyChanged("Code11BarcodeVisibility");
}
}
public Visibility DataMatrixBarcodeVisibility
{
get
{
return dataMatrixBarcodeVisibility;
}
set
{
dataMatrixBarcodeVisibility = value;
OnPropertyChanged("DataMatrixBarcodeVisibility");
}
}
#endregion
#region Methods
private void UpdateSymbology(BarcodeModel barcodeModel)
{
switch(barcodeModel.SymobologyItem)
{
case "CodaBar":
CodabarBarcode codabarBarcode = new CodabarBarcode();
SymbologyItem = codabarBarcode;
break;
case "Code11":
Code11Barcode code11Barcode = new Code11Barcode();
SymbologyItem = code11Barcode;
break;
case "Code32":
Code32Barcode code32Barcode = new Code32Barcode();
SymbologyItem = code32Barcode;
break;
case "Code39":
Code39Barcode code39Barcode = new Code39Barcode();
SymbologyItem = code39Barcode;
break;
case "Code39Extended":
Code39ExtendedBarcode code39ExtendedBarcode = new Code39ExtendedBarcode();
SymbologyItem = code39ExtendedBarcode;
break;
case "Code93":
Code93Barcode code93Barcode = new Code93Barcode();
SymbologyItem = code93Barcode;
break;
case "Code93Extended":
Code93ExtendedBarcode code93ExtendedBarcode = new Code93ExtendedBarcode();
SymbologyItem = code93ExtendedBarcode;
break;
case "Code128A":
Code128ABarcode code128Barcode = new Code128ABarcode();
SymbologyItem = code128Barcode;
break;
case "Code128B":
Code128BBarcode code128BBarcode = new Code128BBarcode();
SymbologyItem = code128BBarcode;
break;
case "Code128C":
Code128CBarcode code128CBarcode = new Code128CBarcode();
SymbologyItem = code128CBarcode;
break;
case "UpcBarcode":
UpcBarcode upcBarcode = new UpcBarcode();
SymbologyItem = upcBarcode;
break;
case "GS1Code128Barcode":
GS1Code128Barcode gS1Code128Barcode = new GS1Code128Barcode();
SymbologyItem = gS1Code128Barcode;
break;
case "Pdf417Barcode":
Pdf417Barcode pdf417Barcode = new Pdf417Barcode();
SymbologyItem = pdf417Barcode;
break;
}
}
private void ValidateCode11Barcode(string value)
{
bool isNumeric = false;
char[] validate = value.ToCharArray();
for (int i = 0; i < validate.Length; i++)
{
if (Char.IsDigit(validate[i]))
{
isNumeric = true;
}
else
{
isNumeric = false;
}
}
if (isNumeric)
{
ValidateCode11BarcodeText = "";
Code11BarcodeVisibility = Visibility.Visible;
}
else
{
ValidateCode11BarcodeText = "Invalid Input";
Code11BarcodeVisibility = Visibility.Collapsed;
}
}
private void ValidateDataMatrixText(string value)
{
bool isNumeric = false;
char[] validate = value.ToCharArray();
for (int i = 0; i < validate.Length; i++)
{
if (Char.IsDigit(validate[i]))
{
isNumeric = true;
}
else
{
isNumeric = false;
}
}
if (isNumeric)
{
ValidateDataMatrixBarcodeText = "";
DataMatrixBarcodeVisibility = Visibility.Visible;
}
else
{
ValidateDataMatrixBarcodeText = "Invalid Input";
DataMatrixBarcodeVisibility = Visibility.Collapsed;
}
}
private void SelectedEncodingValue(BarcodeModel value)
{
bool isNumeric = int.TryParse(DataMatrixBarcodeText, out int data);
if (value.DataMatrixEncoding == "ASCIINumeric")
{
DataMatrixSupportedChar = "[0-9]";
DataMatrixBarcodeText = "583748";
}
else
{
DataMatrixSupportedChar = "[^A-Za-z0-9]";
DataMatrixBarcodeText = "Syncfusion";
}
}
private void OnPropertyChanged(string Parameter)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(Parameter));
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,408 @@
<Page
x:Class="syncfusion.barcodedemos.winui.Views.BarcodeDemoPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:syncfusion.demoscommon.winui"
xmlns:enumextension="using:syncfusion.demoscommon.winui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:syncfusion.barcodedemos.winui"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="using:Syncfusion.UI.Xaml.Barcode"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Page.DataContext>
<local:BarcodeViewModel />
</Page.DataContext>
<ScrollViewer>
<StackPanel>
<common:DemoLayout x:Name="Example1" HeaderText="Code11 barcode control with basic settings.">
<common:DemoLayout.Example>
<Grid>
<syncfusion:SfBarcode
x:Name="barcode"
Width="190"
Height="200"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding Code11BarcodeVisibility, Mode=TwoWay}"
Value="{Binding Code11BarcodeText, Mode=TwoWay}">
<syncfusion:SfBarcode.Symbology>
<syncfusion:Code11Barcode />
</syncfusion:SfBarcode.Symbology>
</syncfusion:SfBarcode>
</Grid>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<CheckBox
x:Name="showValue"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Content="ShowValue"
IsChecked="{Binding ElementName=barcode, Path=ShowValue, Mode=TwoWay}" />
<Slider
x:Name="textSpacing"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="TextSpacing"
Maximum="80"
Minimum="0"
Value="{Binding ElementName=barcode, Path=TextSpacing, Mode=TwoWay}" />
<ComboBox
x:Name="horizontalTextAlignment"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="HorizontalTextAlignment"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=TextAlignment}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=TextAlignment}, ElementName=barcode, Path=HorizontalTextAlignment, Mode=TwoWay}" />
<ComboBox
x:Name="verticalTextAlignment"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="VerticalTextAlignment"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=VerticalAlignment}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=VerticalAlignment}, ElementName=barcode, Path=VerticalTextAlignment, Mode=TwoWay}" />
<ComboBox
x:Name="rotationAngle"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="RotationAngle"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:BarcodeRotation}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:BarcodeRotation}, ElementName=barcode, Path=RotationAngle, Mode=TwoWay}" />
<TextBlock
x:Name="headerCode11Barcode"
Width="185"
Margin="16,5,5,5"
Text="Supported Characters" />
<TextBlock
x:Name="code11SupportedCharacter"
Width="185"
Margin="16,0,5,5"
Text="[0-9]" />
<TextBox
x:Name="code11Text"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="Value"
MaxLength="16"
Text="{Binding Code11BarcodeText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
x:Name="code11ValidateText"
Width="185"
Margin="16,0,5,5"
HorizontalAlignment="Center"
Foreground="Red"
Text="{Binding ValidateCode11BarcodeText}" />
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
&lt;syncfusion:SfBarcode
TextSpacing=&quot;$(TextSpacing)&quot; ShowValue=&quot;$(ShowValue)&quot; Value=&quot;$(Value)&quot;
VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;
HorizontalTextAlignment=&quot;$(HorizontalTextAlignment)&quot; VerticalTextAlignment=&quot;$(VerticalTextAlignment)&quot;
Width=&quot;190&quot; Height=&quot;200&quot; RotationAngle=&quot;$(RotationAngle)&quot;&gt;
&#x09;&lt;syncfusion:SfBarcode.Symbology&gt;
&#x09;&#x09;&lt;syncfusion:Code11Barcode/&gt;
&#x09;&lt;/syncfusion:SfBarcode.Symbology&gt;
&lt;/syncfusion:SfBarcode&gt;
</x:String>
</common:DemoLayout.Xaml>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution Key="TextSpacing" SubstitutionValue="{x:Bind textSpacing.Value, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="ShowValue" SubstitutionValue="{x:Bind showValue.IsChecked, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="Value" SubstitutionValue="{x:Bind code11Text.Text, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="HorizontalTextAlignment" SubstitutionValue="{x:Bind horizontalTextAlignment.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="VerticalTextAlignment" SubstitutionValue="{x:Bind verticalTextAlignment.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="RotationAngle" SubstitutionValue="{x:Bind rotationAngle.SelectedItem, Mode=OneWay}" />
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout x:Name="Example2" HeaderText="Standard 1D barcode types with alignment options, checksum rendering, and start/stop symbol encoding.">
<common:DemoLayout.Example>
<Grid>
<syncfusion:SfBarcode
x:Name="uniDimesionalBarcode"
Width="340"
Height="200"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Symbology="{Binding SymbologyItem}"
TextSpacing="0"
Value="48625310" />
</Grid>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<Slider
x:Name="textSpacingUnidimensional"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="TextSpacing"
Maximum="80"
Minimum="0"
Value="{Binding ElementName=uniDimesionalBarcode, Path=TextSpacing, Mode=TwoWay}" />
<Slider
x:Name="moduleUnidimensional"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="Module"
Maximum="4"
Minimum="0"
Value="{Binding ElementName=uniDimesionalBarcode, Path=Module, Mode=TwoWay}" />
<ComboBox
x:Name="symbology"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
DisplayMemberPath="SymobologyItem"
Header="Symbology"
ItemsSource="{Binding Symbology}"
SelectedIndex="0"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
<ComboBox
x:Name="rotationUnidimensional"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="RotationAngle"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:BarcodeRotation}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:BarcodeRotation}, ElementName=uniDimesionalBarcode, Path=RotationAngle, Mode=TwoWay}" />
<CheckBox
x:Name="encodeStartStopSymbols"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Content="EncodeStartStopSymbols"
IsChecked="{Binding ElementName=uniDimesionalBarcode, Path=Symbology.EncodeStartStopSymbols, Mode=TwoWay}" />
<CheckBox
x:Name="enableCheckSum"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Content="EnableCheckSum"
IsChecked="{Binding ElementName=uniDimesionalBarcode, Path=Symbology.EnableCheckSum, Mode=TwoWay}" />
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
&lt;syncfusion:SfBarcode
VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;
Value=&quot;48625310&quot; TextSpacing=&quot;$(UniDimensionTextSpacing)&quot; Module=&quot;$(Module)&quot;
Symbology=&quot;{Binding Symbology}&quot; RotationAngle=&quot;$(UniDimensionRotationAngle)&quot;
Width=&quot;340&quot; Height=&quot;200&quot;
EncodeStartStopSymbols=&quot;$(EncodeStartStopSymbols)&quot; EnableCheckSum=&quot;$(EnableCheckSum)&quot;/&gt;
</x:String>
</common:DemoLayout.Xaml>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution Key="UniDimensionTextSpacing" SubstitutionValue="{x:Bind textSpacingUnidimensional.Value, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="Module" SubstitutionValue="{x:Bind moduleUnidimensional.Value, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="UniDimensionRotationAngle" SubstitutionValue="{x:Bind rotationUnidimensional.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="EncodeStartStopSymbols" SubstitutionValue="{x:Bind encodeStartStopSymbols.IsChecked, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="EnableCheckSum" SubstitutionValue="{x:Bind enableCheckSum.IsChecked, Mode=OneWay}" />
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout x:Name="Example3" HeaderText="DataMatrix barcode with different types of encoding and matrix size.">
<common:DemoLayout.Example>
<Grid>
<syncfusion:SfBarcode
x:Name="dataMatrixBarcode"
Width="350"
Height="350"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutoModule="True"
Module="10"
Visibility="{Binding DataMatrixBarcodeVisibility, Mode=TwoWay}"
Value="{Binding DataMatrixBarcodeText, Mode=TwoWay}">
<syncfusion:SfBarcode.Symbology>
<syncfusion:DataMatrixBarcode />
</syncfusion:SfBarcode.Symbology>
</syncfusion:SfBarcode>
</Grid>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<CheckBox
x:Name="autoModule"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Content="Auto Module"
IsChecked="{Binding ElementName=dataMatrixBarcode, Path=AutoModule, Mode=TwoWay}" />
<ComboBox
x:Name="encoding"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
DisplayMemberPath="DataMatrixEncoding"
Header="Encoding"
ItemsSource="{Binding EncodingValues}"
SelectedIndex="0"
SelectedItem="{Binding EncodingSelectedValue, Mode=TwoWay}" />
<ComboBox
x:Name="matrixSize"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="MatrixSize"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:DataMatrixSize}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:DataMatrixSize}, ElementName=dataMatrixBarcode, Path=Symbology.MatrixSize, Mode=TwoWay}" />
<ComboBox
x:Name="dataMatrixRotation"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="RotationAngle"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:BarcodeRotation}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:BarcodeRotation}, ElementName=dataMatrixBarcode, Path=RotationAngle, Mode=TwoWay}" />
<TextBlock
x:Name="headerDataMatrixBarcode"
Width="185"
Margin="16,5,5,5"
Text="Supported Characters" />
<TextBlock
x:Name="dataMatrixSupportedCharacter"
Width="185"
Margin="16,0,5,5"
Text="{Binding DataMatrixSupportedChar}" />
<TextBox
x:Name="dataMatrixText"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="Value"
MaxLength="16"
Text="{Binding DataMatrixBarcodeText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Width="185"
Margin="16,0,5,5"
HorizontalAlignment="Center"
Foreground="Red"
Text="{Binding ValidateDataMatrixBarcodeText}" />
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
&lt;syncfusion:SfBarcode
VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;
Value=&quot;$(DataMatrixValue)&quot; Width=&quot;250&quot; Height=&quot;200&quot;
AutoModule=&quot;$(DataMatrixAutoModule)&quot; Module=&quot;$(DataMatrixModule)&quot; RotationAngle=&quot;$(DataMatrixRotationAngle)&quot;&gt;
&#x09;&lt;syncfusion:SfBarcode.Symbology&gt;
&lt;syncfusion:DataMatrixBarcode Encoding=&quot;{Binding Encoding}&quot;
MatrixSize=&quot;$(MatrixSize)&quot;/&gt;
&#x09;&lt;/syncfusion:SfBarcode.Symbology&gt;
&lt;/syncfusion:SfBarcode&gt;
</x:String>
</common:DemoLayout.Xaml>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution Key="DataMatrixValue" SubstitutionValue="{x:Bind dataMatrixText.Text, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="DataMatrixAutoModule" SubstitutionValue="{x:Bind autoModule.IsChecked, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="DataMatrixModule" SubstitutionValue="{x:Bind dataMatrixBarcode.Module, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="DataMatrixRotationAngle" SubstitutionValue="{x:Bind dataMatrixRotation.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="MatrixSize" SubstitutionValue="{x:Bind matrixSize.SelectedItem, Mode=OneWay}" />
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout x:Name="Example4" HeaderText="QR barcode with different types of QR version and approximate level of error correction.">
<common:DemoLayout.Example>
<Grid>
<syncfusion:SfBarcode
x:Name="qrBarcode"
Width="350"
Height="350"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutoModule="True"
Module="10"
Value="{Binding QRBarcodeText, Mode=TwoWay}">
<syncfusion:SfBarcode.Symbology>
<syncfusion:QRBarcode />
</syncfusion:SfBarcode.Symbology>
</syncfusion:SfBarcode>
</Grid>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<CheckBox
x:Name="autoModuleQRBarcode"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Content="Auto Module"
IsChecked="{Binding ElementName=qrBarcode, Path=AutoModule, Mode=TwoWay}" />
<ComboBox
x:Name="errorCorrectionLevel"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="ErrorCorrectionLevel"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:ErrorCorrectionLevel}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:ErrorCorrectionLevel}, ElementName=qrBarcode, Path=Symbology.ErrorCorrectionLevel, Mode=TwoWay}" />
<ComboBox
x:Name="qrversion"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="QRVersion"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:QRBarcodeVersion}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:QRBarcodeVersion}, ElementName=qrBarcode, Path=Symbology.QRVersion, Mode=TwoWay}" />
<ComboBox
x:Name="rotationQRBarcode"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="RotationAngle"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=syncfusion:BarcodeRotation}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=syncfusion:BarcodeRotation}, ElementName=qrBarcode, Path=RotationAngle, Mode=TwoWay}" />
<TextBlock
x:Name="headerQRBarcode"
Width="185"
Margin="16,5,5,5"
Text="Supported Characters" />
<TextBlock
x:Name="QRBarcodeSupportedCharacter"
Width="185"
Margin="16,0,5,5"
Text="[^A-Za-z0-9]" />
<TextBox
x:Name="qrBarcodeText"
Width="185"
Margin="16,5,5,5"
HorizontalAlignment="Center"
Header="Value"
MaxLength="16"
Text="{Binding QRBarcodeText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
&lt;syncfusion:SfBarcode
VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Center&quot;
Value=&quot;$(QRBarcodeValue)&quot; Width=&quot;250&quot; Height=&quot;200&quot;
AutoModule=&quot;$(QRBarcodeAutoModule)&quot; Module=&quot;$(QRBarcodeModule)&quot; RoatationAngle=&quot;$(QRBarcodeRoatationAngle)&quot;&gt;
&#x09;&lt;syncfusion:SfBarcode.Symbology&gt;
&lt;syncfusion:QRBarcode ErrorCorrectionLevel=&quot;$(ErrorCorrectionLevel)&quot;
QRVersion=&quot;$(QRVersion)&quot;/&gt;
&#x09;&lt;/syncfusion:SfBarcode.Symbology&gt;
&lt;/SfBarcode&gt;
</x:String>
</common:DemoLayout.Xaml>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution Key="QRBarcodeValue" SubstitutionValue="{x:Bind qrBarcodeText.Text, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="QRBarcodeAutoModule" SubstitutionValue="{x:Bind autoModuleQRBarcode.IsChecked, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="QRBarcodeModule" SubstitutionValue="{x:Bind qrBarcode.Module, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="QRBarcodeRoatationAngle" SubstitutionValue="{x:Bind rotationQRBarcode.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="ErrorCorrectionLevel" SubstitutionValue="{x:Bind errorCorrectionLevel.SelectedItem, Mode=OneWay}" />
<common:DemoLayoutSubstitution Key="QRVersion" SubstitutionValue="{x:Bind qrversion.SelectedItem, Mode=OneWay}" />
</common:DemoLayout.Substitutions>
</common:DemoLayout>
</StackPanel>
</ScrollViewer>
</Page>

Просмотреть файл

@ -0,0 +1,50 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml.Controls;
using Syncfusion.UI.Xaml.Barcode;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace syncfusion.barcodedemos.winui.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class BarcodeDemoPage : Page, IDisposable
{
public BarcodeDemoPage()
{
this.InitializeComponent();
}
public void Dispose()
{
if (barcode != null)
{
barcode = null;
}
if (uniDimesionalBarcode != null)
{
uniDimesionalBarcode = null;
}
if (dataMatrixBarcode != null)
{
dataMatrixBarcode = null;
}
if (qrBarcode != null)
{
qrBarcode = null;
}
}
}
}

15
barcode/app.manifest Normal file
Просмотреть файл

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="syncfusion.barcodedemos.winui_net50.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>

Просмотреть файл

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\syncfusion.common.desktop.props" />
<PropertyGroup>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>syncfusion.barcodedemos.winui</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<EnableDefaultPageItems>false</EnableDefaultPageItems>
<AssemblyName>syncfusion.barcodedemos.winui</AssemblyName>
<Platforms>AnyCPU;x86;x64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI;WinUI_Desktop</DefineConstants>
<UseWinUI>true</UseWinUI>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Content Remove="Assets\**" />
<EmbeddedResource Remove="Assets\**" />
<EmbeddedResource Remove="Properties\PublishProfiles\**" />
<EmbeddedResource Remove="syncfusion.barcodedemos.winui_net50 %28Package%29\**" />
<None Remove="Assets\**" />
<None Remove="Properties\PublishProfiles\**" />
<None Remove="syncfusion.barcodedemos.winui_net50 %28Package%29\**" />
<None Remove="app.manifest" />
<None Remove="App.xaml" />
<None Remove="MainWindow.xaml" />
<None Remove="Package.appxmanifest" />
<None Remove="Properties\Default.rd.xml" />
<None Remove="syncfusion.barcodedemos.winui_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Model\BarcodeModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SamplesConfiguration.cs" />
<Compile Include="ViewModel\BarcodeViewModel.cs" />
<Compile Include="Views\BarcodeDemoPage.xaml.cs">
<DependentUpon>BarcodeDemoPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="Views\BarcodeDemoPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Syncfusion.Barcode.WinUI" Version="19.3.0.53" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\common\syncfusion.demoscommon.winui_lib_net50.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30523.141
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "syncfusion.barcodedemos.winui_lib_net50", "syncfusion.barcodedemos.winui_lib_net50.csproj", "{8F9943FA-AF0B-4DD4-B240-7408C43326C6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|x64.ActiveCfg = Debug|x64
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|x64.Build.0 = Debug|x64
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|x86.ActiveCfg = Debug|x86
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Debug|x86.Build.0 = Debug|x86
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|Any CPU.Build.0 = Release|Any CPU
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|x64.ActiveCfg = Release|x64
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|x64.Build.0 = Release|x64
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|x86.ActiveCfg = Release|x86
{8F9943FA-AF0B-4DD4-B240-7408C43326C6}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {38E89E8B-5BA5-442B-9CEB-5A6080DCB243}
EndGlobalSection
EndGlobal

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 25 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.1 KiB

Просмотреть файл

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="70f1797c-f284-46ac-9978-12e17a9f2245"
Publisher="CN=BerkunathAnnamariyan"
Version="1.0.0.0" />
<Properties>
<DisplayName>syncfusion.barcodedemos.winui_net50 (Package)</DisplayName>
<PublisherDisplayName>BerkunathAnnamariyan</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="syncfusion.barcodedemos.winui_net50 (Package)"
Description="syncfusion.barcodedemos.winui_net50 (Package)"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

Просмотреть файл

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|arm64">
<Configuration>Debug</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|arm64">
<Configuration>Release</Configuration>
<Platform>arm64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>syncfusion.barcodedemos.winui_net50\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>0f15615d-3448-43f2-b0e3-fd204d76839c</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<AssetTargetFallback>net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\syncfusion.barcodedemos.winui_net50.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.1]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\syncfusion.barcodedemos.winui_net50.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" />
<!-- Needed for ucrtbased.dll when running a debug build. -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,107 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\syncfusion.common.desktop.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<EnableDefaultPageItems>false</EnableDefaultPageItems>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<AssemblyName>syncfusion.barcodedemos.winui</AssemblyName>
<RootNamespace>syncfusion.barcodedemos.winui</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>AnyCPU;x86;x64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI;WinUI_Desktop</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;WinUI_Desktop</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<Content Remove="Assets\**" />
<EmbeddedResource Remove="Assets\**" />
<EmbeddedResource Remove="Properties\PublishProfiles\**" />
<EmbeddedResource Remove="syncfusion.barcodedemos.winui_net50 %28Package%29\**" />
<None Remove="Assets\**" />
<None Remove="Properties\PublishProfiles\**" />
<None Remove="syncfusion.barcodedemos.winui_net50 %28Package%29\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Package.appxmanifest" />
<None Remove="Properties\Default.rd.xml" />
<None Remove="syncfusion.barcodedemos.winui_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Model\BarcodeModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SamplesConfiguration.cs" />
<Compile Include="ViewModel\BarcodeViewModel.cs" />
<Compile Include="Views\BarcodeDemoPage.xaml.cs">
<DependentUpon>BarcodeDemoPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xaml" />
<Page Include="Views\BarcodeDemoPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VCRTForwarders.140" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Syncfusion.Barcode.WinUI" Version="19.3.0.53" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\common\syncfusion.demoscommon.winui_lib_net50.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,75 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30524.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "syncfusion.barcodedemos.winui_net50 (Package)", "syncfusion.barcodedemos.winui_net50 (Package)\syncfusion.barcodedemos.winui_net50 (Package).wapproj", "{0F15615D-3448-43F2-B0E3-FD204D76839C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "syncfusion.barcodedemos.winui_net50", "syncfusion.barcodedemos.winui_net50.csproj", "{BBBFEA37-236C-45D0-B205-26E708E544A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "syncfusion.demoscommon.winui_lib_net50", "..\common\syncfusion.demoscommon.winui_lib_net50.csproj", "{FF192628-A93D-437C-A926-9E6C3C1B0CE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|Any CPU.ActiveCfg = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|Any CPU.Build.0 = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|Any CPU.Deploy.0 = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x64.ActiveCfg = Debug|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x64.Build.0 = Debug|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x64.Deploy.0 = Debug|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x86.ActiveCfg = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x86.Build.0 = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Debug|x86.Deploy.0 = Debug|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|Any CPU.ActiveCfg = Release|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x64.ActiveCfg = Release|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x64.Build.0 = Release|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x64.Deploy.0 = Release|x64
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x86.ActiveCfg = Release|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x86.Build.0 = Release|x86
{0F15615D-3448-43F2-B0E3-FD204D76839C}.Release|x86.Deploy.0 = Release|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|Any CPU.ActiveCfg = Debug|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|Any CPU.Build.0 = Debug|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x64.ActiveCfg = Debug|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x64.Build.0 = Debug|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x64.Deploy.0 = Debug|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x86.ActiveCfg = Debug|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x86.Build.0 = Debug|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Debug|x86.Deploy.0 = Debug|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|Any CPU.ActiveCfg = Release|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x64.ActiveCfg = Release|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x64.Build.0 = Release|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x64.Deploy.0 = Release|x64
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x86.ActiveCfg = Release|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x86.Build.0 = Release|x86
{BBBFEA37-236C-45D0-B205-26E708E544A4}.Release|x86.Deploy.0 = Release|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|Any CPU.ActiveCfg = Debug|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|Any CPU.Build.0 = Debug|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x64.ActiveCfg = Debug|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x64.Build.0 = Debug|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x64.Deploy.0 = Debug|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x86.ActiveCfg = Debug|Any CPU
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x86.Build.0 = Debug|Any CPU
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Debug|x86.Deploy.0 = Debug|Any CPU
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|Any CPU.ActiveCfg = Release|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x64.ActiveCfg = Release|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x64.Build.0 = Release|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x64.Deploy.0 = Release|x64
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x86.ActiveCfg = Release|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x86.Build.0 = Release|x86
{FF192628-A93D-437C-A926-9E6C3C1B0CE2}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CFC9929D-1247-423A-BB9B-2370177C5D8C}
EndGlobalSection
EndGlobal

13
calendar/App.xaml Normal file
Просмотреть файл

@ -0,0 +1,13 @@
<Application x:Class="syncfusion.calendardemos.winui.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

160
calendar/App.xaml.cs Normal file
Просмотреть файл

@ -0,0 +1,160 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.ApplicationModel.Core;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace syncfusion.calendardemos.winui
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
#if !WinUI_Desktop
this.Suspending += OnSuspending;
#endif
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
{
#if WinUI_Desktop
m_window = new MainWindow();
m_window.Activate();
Frame rootFrame = m_window.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// rootFrame.NavigationFailed += OnNavigationFailed;
if (e != null && e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
m_window.Content = rootFrame;
}
// if (args != null && args.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
{
#pragma warning disable CA1806 // Do not ignore method results
new SamplesConfiguration();
#pragma warning restore CA1806 // Do not ignore method results
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(demoscommon.winui.MainPage), e.Arguments);
}
// Ensure the current window is active
m_window.Activate();
}
#else
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
{
new SamplesConfiguration();
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(demoscommon.winui.MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
#endif
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
#if !WinUI_Desktop
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
#else
private MainWindow m_window;
#endif
}
}

Двоичные данные
calendar/Assets/Tiles/LargeTile.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичные данные
calendar/Assets/Tiles/LargeTile.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Двоичные данные
calendar/Assets/Tiles/LargeTile.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 38 KiB

Двоичные данные
calendar/Assets/Tiles/SmallTile.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
calendar/Assets/Tiles/SmallTile.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Двоичные данные
calendar/Assets/Tiles/SmallTile.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.9 KiB

Двоичные данные
calendar/Assets/Tiles/SplashScreen.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.8 KiB

Двоичные данные
calendar/Assets/Tiles/SplashScreen.scale-125.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
calendar/Assets/Tiles/SplashScreen.scale-150.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
calendar/Assets/Tiles/SplashScreen.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 25 KiB

Двоичные данные
calendar/Assets/Tiles/SplashScreen.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 72 KiB

Двоичные данные
calendar/Assets/Tiles/Square150x150Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.4 KiB

Двоичные данные
calendar/Assets/Tiles/Square150x150Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Двоичные данные
calendar/Assets/Tiles/Square150x150Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
calendar/Assets/Tiles/Square44x44Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
calendar/Assets/Tiles/Square44x44Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.0 KiB

Двоичные данные
calendar/Assets/Tiles/Square44x44Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.3 KiB

Двоичные данные
calendar/Assets/Tiles/StoreLogo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичные данные
calendar/Assets/Tiles/StoreLogo.scale-125.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.6 KiB

Двоичные данные
calendar/Assets/Tiles/StoreLogo.scale-150.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.3 KiB

Двоичные данные
calendar/Assets/Tiles/StoreLogo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.8 KiB

Двоичные данные
calendar/Assets/Tiles/StoreLogo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
calendar/Assets/Tiles/Wide310x150Logo.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.6 KiB

Двоичные данные
calendar/Assets/Tiles/Wide310x150Logo.scale-200.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.1 KiB

Двоичные данные
calendar/Assets/Tiles/Wide310x150Logo.scale-400.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 18 KiB

Просмотреть файл

@ -0,0 +1,115 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace syncfusion.calendardemos.winui
{
public class DateFormatToDisplayFormatConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var option = value.ToString();
var abb = "Abbreviated";
var full = "Full";
var num = "Number";
switch (parameter.ToString())
{
case "day":
if (option == abb)
{
return "{day.integer}";
}
else if (option == full)
{
return "{day.integer(2)}";
}
break;
case "month":
if (option == abb)
{
return "{month.abbreviated}";
}
else if (option == full)
{
return "{month.full}";
}
else if (option == num)
{
return "{month.integer}";
}
break;
case "dayofweek":
if (option == "Abbreviated - 2 char")
{
return "{dayofweek.abbreviated(2)}";
}
else if (option == "Abbreviated - 3 char")
{
return "{dayofweek.abbreviated(3)}";
}
else if (option == "Full")
{
return "{dayofweek.full}";
}
break;
case "header":
if (option == abb)
{
return "{month.abbreviated} {year.abbreviated}";
}
else if (option == full)
{
return "month year";
}
break;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
public class ValueToUlongConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value != null)
{
double.TryParse(value.ToString(), out double count);
return count;
}
return 0;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value == null)
return 0;
else
{
ulong.TryParse(value.ToString(), out ulong count);
return count;
}
}
}
}

11
calendar/MainWindow.xaml Normal file
Просмотреть файл

@ -0,0 +1,11 @@
<Window
x:Class="syncfusion.calendardemos.winui.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:syncfusion.calendardemos.winui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Frame/>
</Window>

Просмотреть файл

@ -0,0 +1,39 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace syncfusion.calendardemos.winui
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.Title = "Syncfusion Calendar Controls Gallery for WinUI Desktop";
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("syncfusion.calendardemos.winui")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Syncfusion Inc.")]
[assembly: AssemblyProduct("syncfusion.calendardemos.winui")]
[assembly: AssemblyCopyright("Copyright © 2001-2021 Syncfusion Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("19.3300.0.53")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -0,0 +1,31 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Просмотреть файл

@ -0,0 +1,180 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 syncfusion.demoscommon.winui;
using System;
using System.Collections.Generic;
namespace syncfusion.calendardemos.winui
{
public class SamplesConfiguration
{
public SamplesConfiguration()
{
DemoInfo calendarDemo = new DemoInfo()
{
Name = "Getting Started",
Category = "Calendar",
DemoType = DemoTypes.None,
Description = "The Calendar allows users to select the date.",
DemoView = typeof(Views.Calendar.CalendarView),
ShowInfoPanel=true
};
List<Documentation> calendarDemoDocumentations = new List<Documentation>();
calendarDemoDocumentations.Add(new Documentation() { Content = "Calendar - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendar.html") });
calendarDemoDocumentations.Add(new Documentation() { Content = "Calendar - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar/getting-started") });
calendarDemoDocumentations.Add(new Documentation() { Content = "Calendar - Date Selection", Uri = new Uri("https://help.syncfusion.com/winui/calendar/selection") });
calendarDemoDocumentations.Add(new Documentation() { Content = "Calendar - View Navigation", Uri = new Uri("https://help.syncfusion.com/winui/calendar/navigation") });
calendarDemoDocumentations.Add(new Documentation() { Content = "Calendar - Calendar Types", Uri = new Uri("https://help.syncfusion.com/winui/calendar/localization-and-formatting#types-of-calendar") });
calendarDemo.Documentation.AddRange(calendarDemoDocumentations);
DemoInfo calendarCustomizationDemo = new DemoInfo()
{
Name = "Customization",
Category = "Calendar",
DemoType = DemoTypes.None,
Description = "Customization of the dates.",
DemoView = typeof(Views.Calendar.Customization),
ShowInfoPanel = true
};
List<Documentation> calendarCustomizationDemoDocumentations = new List<Documentation>();
calendarCustomizationDemoDocumentations.Add(new Documentation() { Content = "Calendar - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendar.html") });
calendarCustomizationDemoDocumentations.Add(new Documentation() { Content = "Calendar - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar/getting-started") });
calendarCustomizationDemoDocumentations.Add(new Documentation() { Content = "Calendar - Date Formatting", Uri = new Uri("https://help.syncfusion.com/winui/calendar/localization-and-formatting#change-date-display-format") });
calendarCustomizationDemoDocumentations.Add(new Documentation() { Content = "Calendar - Block All Weekends", Uri = new Uri("https://help.syncfusion.com/winui/calendar/restrict-date-selection#disable-dates-dynamically-all-weekend-days") });
calendarCustomizationDemoDocumentations.Add(new Documentation() { Content = "Calendar - Block Specific Dates", Uri = new Uri("https://help.syncfusion.com/winui/calendar/restrict-date-selection#disable-dates-using-blackoutdates") });
calendarCustomizationDemo.Documentation.AddRange(calendarCustomizationDemoDocumentations);
DemoInfo calendarStylesAndTemplatesDemo = new DemoInfo()
{
Name = "Styles and Templates",
Category = "Calendar",
DemoType = DemoTypes.None,
Description = "Customization of styles and templates of the Calendar.",
DemoView = typeof(Views.Calendar.StylesAndTemplates),
ShowInfoPanel = true
};
List<Documentation> calendarStylesAndTemplatesDemoDocumentations = new List<Documentation>();
calendarStylesAndTemplatesDemoDocumentations.Add(new Documentation() { Content = "Calendar - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendar.html") });
calendarStylesAndTemplatesDemoDocumentations.Add(new Documentation() { Content = "Calendar - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar/getting-started") });
calendarStylesAndTemplatesDemoDocumentations.Add(new Documentation() { Content = "Calendar - Specific Cell's Custom UI", Uri = new Uri("https://help.syncfusion.com/winui/calendar/ui-customization#custom-ui-for-specific-cell-in-calendar") });
calendarStylesAndTemplatesDemo.Documentation.AddRange(calendarStylesAndTemplatesDemoDocumentations);
var calendar = new ControlInfo()
{
Control = DemoControl.SfCalendar,
ControlBadge = ControlBadge.None,
ControlCategory = ControlCategory.Calendars,
Description = "The Calendar control allows user to select a date or dates quickly using built-in month, year, decade, and century views.",
Glyph = "\uE710"
};
calendar.Demos.Add(calendarDemo);
calendar.Demos.Add(calendarCustomizationDemo);
calendar.Demos.Add(calendarStylesAndTemplatesDemo);
DemoInfo calendarDatePickerDemo = new DemoInfo()
{
Name = "Getting Started",
Category = "Calendar Date Picker",
DemoType = DemoTypes.None,
Description = "The Calendar Date Picker allows users to select the date through a drop-down menu.",
DemoView = typeof(Views.CalendarDatePicker.CalendarDatePickerView),
ShowInfoPanel = true
};
List<Documentation> calendarDatePickerDemoDocumentations = new List<Documentation>();
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendarDatePicker.html") });
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar-datepicker/getting-started") });
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - View Navigation", Uri = new Uri("https://help.syncfusion.com/winui/calendar-date-picker/navigation") });
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Calendar Types", Uri = new Uri("https://help.syncfusion.com/winui/calendar-date-picker/localization-and-formatting#types-of-calendar") });
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Date Formatting", Uri = new Uri("https://help.syncfusion.com/winui/calendar-date-picker/localization-and-formatting#change-calendar-display-format") });
calendarDatePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Block Specific Dates", Uri = new Uri("https://help.syncfusion.com/winui/calendar-date-picker/date-selection-and-restriction#block-dates-using-blackoutdates") });
calendarDatePickerDemo.Documentation.AddRange(calendarDatePickerDemoDocumentations);
DemoInfo calendarDatePickerCustomizationDemo = new DemoInfo()
{
Name = "Styles and Templates",
Category = "Calendar Date Picker",
DemoType = DemoTypes.None,
Description = "Customization of styles and templates of the Calendar Date Picker.",
DemoView = typeof(Views.CalendarDatePicker.Customization),
ShowInfoPanel = true
};
List<Documentation> calendarDatePickerCustomizationDemoDocumentations = new List<Documentation>();
calendarDatePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendarDatePicker.html") });
calendarDatePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar-datepicker/getting-started") });
calendarDatePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDatePicker - Specific Cell's Custom UI", Uri = new Uri("https://help.syncfusion.com/winui/calendar-date-picker/calendar-ui-customization#customize-individual-items-in-calendar") });
calendarDatePickerCustomizationDemo.Documentation.AddRange(calendarDatePickerCustomizationDemoDocumentations);
var calendarDatePicker = new ControlInfo()
{
Control = DemoControl.SfCalendarDatePicker,
ControlBadge = ControlBadge.None,
ControlCategory = ControlCategory.Calendars,
Description = "The Calendar DatePicker is a drop-down control that is optimized for picking a single date from a Calendar control.",
Glyph = "\uE711"
};
calendarDatePicker.Demos.Add(calendarDatePickerDemo);
calendarDatePicker.Demos.Add(calendarDatePickerCustomizationDemo);
DemoInfo calendarDateRangePickerDemo = new DemoInfo()
{
Name = "Getting Started",
Category = "Calendar DateRange Picker",
DemoType = DemoTypes.None,
Description = "The Calendar DateRangePicker allows users to select a range of dates.",
DemoView = typeof(Views.CalendarDateRangePicker.CalendarDateRangePickerView),
ShowInfoPanel = true
};
List<Documentation> calendarDateRangePickerDemoDocumentations = new List<Documentation>();
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendarDateRangePicker.html") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/getting-started") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - View Navigation", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/navigation") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Calendar Types", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/localization-and-formatting#types-of-calendar") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Date Formatting", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/localization-and-formatting#change-calendar-display-format") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Preset Items", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/show-preset-items") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Block All Weekends", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/restrict-daterange-selection#disable-dates-dynamically-all-weekend-days") });
calendarDateRangePickerDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Block Specific Dates", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/restrict-daterange-selection#disable-dates-using-blackoutdates") });
calendarDateRangePickerDemo.Documentation.AddRange(calendarDatePickerDemoDocumentations);
DemoInfo calendarDateRangePickerCustomizationDemo = new DemoInfo()
{
Name = "Styles and Templates",
Category = "Calendar DateRange Picker",
DemoType = DemoTypes.None,
Description = "Customization of styles and templates of the Calendar DateRange Picker.",
DemoView = typeof(Views.CalendarDateRangePicker.Customization),
ShowInfoPanel = true
};
List<Documentation> calendarDateRangePickerCustomizationDemoDocumentations = new List<Documentation>();
calendarDateRangePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - API Reference", Uri = new Uri("https://help.syncfusion.com/cr/winui/Syncfusion.UI.Xaml.Calendar.SfCalendarDateRangePicker.html") });
calendarDateRangePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Getting Started", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/getting-started") });
calendarDateRangePickerCustomizationDemoDocumentations.Add(new Documentation() { Content = "CalendarDateRangePicker - Specific Cell's Custom UI", Uri = new Uri("https://help.syncfusion.com/winui/calendar-daterange-picker/calendar-ui-customization#customize-individual-items-in-calendar") });
calendarDateRangePickerCustomizationDemo.Documentation.AddRange(calendarDatePickerCustomizationDemoDocumentations);
var calendarDateRangePicker = new ControlInfo()
{
Control = DemoControl.SfCalendarDateRangePicker,
ControlBadge = ControlBadge.None,
ControlCategory = ControlCategory.Calendars,
Description = "The Calendar DateRangePicker is a drop-down control optimized for selecting a range of dates from a calendar control.",
Glyph = "\uE713"
};
calendarDateRangePicker.Demos.Add(calendarDateRangePickerDemo);
calendarDateRangePicker.Demos.Add(calendarDateRangePickerCustomizationDemo);
var controlInfos = new List<ControlInfo>()
{
calendar,
calendarDatePicker,
calendarDateRangePicker
};
DemoHelper.ControlInfos.AddRange(controlInfos);
}
}
}

Просмотреть файл

@ -0,0 +1,468 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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.Controls;
using Syncfusion.UI.Xaml.Calendar;
using Syncfusion.UI.Xaml.Core;
using Syncfusion.UI.Xaml.Editors;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace syncfusion.calendardemos.winui
{
public class CalendarViewModel : NotificationObject
{
private DateTimeOffset minDate = new DateTimeOffset(1921, 1, 1, DateTimeOffset.Now.Hour, DateTimeOffset.Now.Minute, DateTimeOffset.Now.Second, DateTimeOffset.Now.Offset);
private DateTimeOffset maxDate = new DateTimeOffset(2121, 12, 31, DateTimeOffset.Now.Hour, DateTimeOffset.Now.Minute, DateTimeOffset.Now.Second, DateTimeOffset.Now.Offset);
private DateTimeOffset? selectedDate = DateTimeOffset.Now;
private DateTimeOffsetCollection blackoutDates = new DateTimeOffsetCollection();
private DateTimeOffsetCollection blackoutSpecificDates = new DateTimeOffsetCollection();
private CalendarDisplayMode minDisplayMode = CalendarDisplayMode.Month;
private CalendarDisplayMode maxDisplayMode = CalendarDisplayMode.Century;
private DateTimeOffset minimumDate = new DateTimeOffset(1601, 1, 1, 6, 0, 0, new TimeSpan(0));
private DateTimeOffset maximumDate = DateTimeOffset.MaxValue;
private DateTimeOffsetRange selectedRange;
private DateTimeOffsetRange selectionRange;
public DateTimeOffsetRange SelectedRange
{
get
{
return selectedRange;
}
set
{
selectedRange = value;
this.RaisePropertyChanged(nameof(this.SelectedRange));
}
}
public DateTimeOffsetRange SelectionRange
{
get
{
return selectionRange;
}
set
{
selectionRange = value;
this.RaisePropertyChanged(nameof(this.SelectionRange));
}
}
public CalendarDisplayMode MinDisplayMode
{
get { return minDisplayMode; }
set
{
if (value != minDisplayMode)
{
minDisplayMode = value;
if (maxDisplayMode < minDisplayMode)
{
MaxDisplayMode = minDisplayMode;
}
RaisePropertyChanged(nameof(MinDisplayMode));
}
}
}
public CalendarDisplayMode MaxDisplayMode
{
get { return maxDisplayMode; }
set
{
if (value != maxDisplayMode)
{
maxDisplayMode = value;
if (minDisplayMode > maxDisplayMode)
{
MinDisplayMode = maxDisplayMode;
}
RaisePropertyChanged(nameof(MaxDisplayMode));
}
}
}
private string dateFormat = "{month.full}";
public string DateFormat
{
get { return dateFormat; }
set { dateFormat = value; RaisePropertyChanged(nameof(DateFormat)); }
}
private bool showSubmit;
public bool ShowSubmitButtons
{
get { return showSubmit; }
set { showSubmit = value; RaisePropertyChanged(nameof(ShowSubmitButtons)); }
}
private ulong minDaycount;
public ulong MinDayCount
{
get { return minDaycount; }
set { minDaycount = value;
RaisePropertyChanged(nameof(MinDayCount));
}
}
private ulong? maxDaycount;
public ulong? MaxDayCount
{
get { return maxDaycount; }
set { maxDaycount = value; RaisePropertyChanged(nameof(MaxDayCount)); }
}
private ObservableCollection<string> presetCollection;
public ObservableCollection<string> PresetColection
{
get { return presetCollection; }
set { presetCollection = value; RaisePropertyChanged(nameof(PresetColection)); }
}
private bool showCalendar = true;
public bool ShowCalendar
{
get { return showCalendar ; }
set { showCalendar = value; RaisePropertyChanged(nameof(ShowCalendar)); }
}
public CalendarViewModel()
{
this.UpdateWeekendDates();
this.AddBlackoutDates();
Items = new ObservableCollection<string>();
Items.Add("JulianCalendar");
Items.Add("GregorianCalendar");
Items.Add("HebrewCalendar");
Items.Add("HijriCalendar");
Items.Add("KoreanCalendar");
Items.Add("TaiwanCalendar");
Items.Add("UmAlQuraCalendar");
Items.Add("PersianCalendar");
Items.Add("ThaiCalendar");
PresetColection = new ObservableCollection<string>();
PresetColection.Add("This Week");
PresetColection.Add("This Month");
PresetColection.Add("Last Month");
PresetColection.Add("This Year");
PresetColection.Add("Custom Range");
var lang = new LanguageList();
Languages = lang.Languages;
}
public DateTimeOffset MinDate
{
get
{
return minDate;
}
set
{
if (minDate != value)
{
minDate = value;
this.RaisePropertyChanged(nameof(this.MinDate));
}
}
}
public DateTimeOffset MaxDate
{
get
{
return maxDate;
}
set
{
if (maxDate != value)
{
maxDate = value;
this.RaisePropertyChanged(nameof(this.MaxDate));
}
}
}
public DateTimeOffset? SelectedDate
{
get
{
return selectedDate;
}
set
{
if (selectedDate != value)
{
selectedDate = value;
this.RaisePropertyChanged(nameof(this.SelectedDate));
}
}
}
public DateTimeOffsetCollection BlackoutDates
{
get
{
return blackoutDates;
}
set
{
if (blackoutDates != value)
{
blackoutDates = value;
this.RaisePropertyChanged(nameof(this.BlackoutDates));
}
}
}
public DateTimeOffsetCollection BlackoutSpecificDates
{
get
{
return blackoutSpecificDates;
}
set
{
if (blackoutSpecificDates != value)
{
blackoutSpecificDates = value;
this.RaisePropertyChanged(nameof(this.BlackoutSpecificDates));
}
}
}
public ObservableCollection<string> Items { get; set; }
public List<LanguageList.Language> Languages { get; set; }
/// <summary>
/// Gets or sets the minimum date for CalendarDatePicker contained in options to change Minimum and Maximum date.
/// </summary>
public DateTimeOffset MinimumDate
{
get
{
return minimumDate;
}
set
{
if (minimumDate != value)
{
minimumDate = value;
this.RaisePropertyChanged(nameof(this.MinimumDate));
}
}
}
/// <summary>
/// Gets or sets the maximum date for CalendarDatePicker contained in options to change Minimum and Maximum date.
/// </summary>
public DateTimeOffset MaximumDate
{
get
{
return maximumDate;
}
set
{
if (maximumDate != value)
{
maximumDate = value;
this.RaisePropertyChanged(nameof(this.MaximumDate));
}
}
}
private void AddBlackoutDates()
{
//BlackoutDates for Previous Month
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 2)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 6)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 8)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 10)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 12)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 15)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 17)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 19)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 22)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 25)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 26)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 28)));
//BlackoutDates for Current Month
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 4)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 5)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 6)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 9)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 11)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 13)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 14)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 17)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 19)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 23)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 26)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 27)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28)));
//BlackoutDates for Next Month
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 2)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 6)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 8)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 12)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 15)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 19)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 22)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 25)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 26)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 28)));
}
private void UpdateWeekendDates()
{
int month = DateTime.Now.Month;
int year = DateTime.Now.Year;
int noOfDays = DateTime.DaysInMonth(year, month);
DateTime dateTime = new DateTime(year, month, 1);
for (int i = 0; i < noOfDays; i++)
{
DateTime date = dateTime.AddDays(i);
if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
{
if (this.selectedDate.HasValue && this.SelectedDate.Value.Date != date)
blackoutDates.Add(date);
}
}
}
}
public class LanguageList
{
private List<Language> _languages;
public List<Language> Languages
{
get { return _languages; }
}
public LanguageList()
{
if (_languages == null)
{
_languages = new List<Language>();
}
_languages.Add(new Language("English", "en"));
_languages.Add(new Language("Arabic", "ar"));
_languages.Add(new Language("Afrikaans", "af"));
_languages.Add(new Language("Albanian", "sq"));
_languages.Add(new Language("Amharic", "am"));
_languages.Add(new Language("Armenian", "hy"));
_languages.Add(new Language("Assamese", "as"));
_languages.Add(new Language("Azerbaijani", "az"));
_languages.Add(new Language("Basque ", "eu"));
_languages.Add(new Language("Belarusian", "be"));
_languages.Add(new Language("Bangla", "bn"));
_languages.Add(new Language("Bosnian", "bs"));
_languages.Add(new Language("Bulgarian", "bg"));
_languages.Add(new Language("Catalan", "ca"));
_languages.Add(new Language("Chinese (Simplified)", "zh"));
_languages.Add(new Language("Croatian", "hr"));
_languages.Add(new Language("Czech", "cs"));
_languages.Add(new Language("Danish", "da"));
_languages.Add(new Language("Dari", "prs"));
_languages.Add(new Language("Dutch", "nl"));
_languages.Add(new Language("Estonian", "et"));
_languages.Add(new Language("Filipino", "fil"));
_languages.Add(new Language("Finnish", "fi"));
_languages.Add(new Language("French ", "fr"));
_languages.Add(new Language("Galician", "gl"));
_languages.Add(new Language("Georgian", "ka"));
_languages.Add(new Language("German", "de"));
_languages.Add(new Language("Greek", "el"));
_languages.Add(new Language("Gujarati", "gu"));
_languages.Add(new Language("Hausa", "ha"));
_languages.Add(new Language("Hebrew", "he"));
_languages.Add(new Language("Hindi", "hi"));
_languages.Add(new Language("Hungarian", "hu"));
_languages.Add(new Language("Icelandic", "is"));
_languages.Add(new Language("Indonesian", "id"));
_languages.Add(new Language("Irish", "ga"));
_languages.Add(new Language("isiXhosa", "xh"));
_languages.Add(new Language("isiZulu", "zu"));
_languages.Add(new Language("Italian", "it"));
_languages.Add(new Language("Japanese ", "ja"));
_languages.Add(new Language("Kannada", "kn"));
_languages.Add(new Language("Kazakh", "kk"));
_languages.Add(new Language("Khmer", "km"));
_languages.Add(new Language("Kinyarwanda", "rw"));
_languages.Add(new Language("KiSwahili", "sw"));
_languages.Add(new Language("Konkani", "kok"));
_languages.Add(new Language("Korean", "ko"));
_languages.Add(new Language("Lao", "lo"));
_languages.Add(new Language("Latvian", "lv"));
_languages.Add(new Language("Lithuanian", "lt"));
_languages.Add(new Language("Luxembourgish", "lb"));
_languages.Add(new Language("Macedonian", "mk"));
_languages.Add(new Language("Malay", "ms"));
_languages.Add(new Language("Malayalam", "ml"));
_languages.Add(new Language("Maltese", "mt"));
_languages.Add(new Language("Maori ", "mi"));
_languages.Add(new Language("Marathi", "mr"));
_languages.Add(new Language("Nepali", "ne"));
_languages.Add(new Language("Norwegian", "nb"));
_languages.Add(new Language("Odia", "or"));
_languages.Add(new Language("Persian", "fa"));
_languages.Add(new Language("Polish", "pl"));
_languages.Add(new Language("Portuguese", "pt"));
_languages.Add(new Language("Punjabi", "pa"));
_languages.Add(new Language("Quechua", "quz"));
_languages.Add(new Language("Romanian", "ro"));
_languages.Add(new Language("Russian", "ru"));
_languages.Add(new Language("Serbian (Latin)", "sr"));
_languages.Add(new Language("Sesotho sa Leboa", "nso"));
_languages.Add(new Language("Setswana", "tn"));
_languages.Add(new Language("Sinhala", "si"));
_languages.Add(new Language("Slovak ", "sk"));
_languages.Add(new Language("Slovenian", "sl"));
_languages.Add(new Language("Spanish", "es"));
_languages.Add(new Language("Swedish", "sv"));
_languages.Add(new Language("Tamil", "ta"));
_languages.Add(new Language("Telugu", "te"));
_languages.Add(new Language("Thai", "th"));
_languages.Add(new Language("Tigrinya", "ti"));
_languages.Add(new Language("Turkish", "tr"));
_languages.Add(new Language("Ukrainian", "uk"));
_languages.Add(new Language("Urdu", "ur"));
_languages.Add(new Language("Uzbek (Latin)", "uz"));
_languages.Add(new Language("Vietnamese", "vi"));
_languages.Add(new Language("Welsh", "cy"));
_languages.Add(new Language("Wolof", "wo"));
}
public class Language
{
public string Name { get; set; }
public string Code { get; set; }
public Language(string name, string code)
{
this.Name = name;
this.Code = code;
}
}
}
}

Просмотреть файл

@ -0,0 +1,197 @@
<Page
x:Class="syncfusion.calendardemos.winui.Views.Calendar.CalendarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:syncfusion.calendardemos.winui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:common="using:syncfusion.demoscommon.winui"
xmlns:enumextension="using:syncfusion.demoscommon.winui"
xmlns:calendar="using:Syncfusion.UI.Xaml.Calendar"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.DataContext>
<local:CalendarViewModel x:Name="viewModel"/>
</Page.DataContext>
<ScrollViewer>
<StackPanel x:Name="calendarViewPanel">
<common:DemoLayout
HeaderText="A simple Calendar control."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/SimpleCalendar_xaml.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar1"/>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<ComboBox
Margin="5"
Width="180"
Header="SelectionMode"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=calendar:CalendarSelectionMode},ElementName=calendar1,Path=SelectionMode, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:CalendarSelectionMode}"/>
<ComboBox
Margin="5"
Width="180"
Header="SelectionShape"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=calendar:SelectionShape}, ElementName=calendar1,Path=SelectionShape, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:SelectionShape}"/>
<ComboBox
Margin="5"
Width="180"
Header="SelectionHighlightMode"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=calendar:SelectionHighlightMode}, ElementName=calendar1,Path=SelectionHighlightMode, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:SelectionHighlightMode}"/>
<ComboBox
Margin="5"
Width="180"
Header="FirstDayOfWeek"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=calendar:FirstDayOfWeek}, ElementName=calendar1,Path=FirstDayOfWeek, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:FirstDayOfWeek}"/>
<Slider
Margin="5"
Width="180"
Header="NumberOfWeeksInView"
Value="{Binding ElementName=calendar1, Path=NumberOfWeeksInView, Mode=TwoWay}"
Minimum="1"
Maximum="10"/>
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution
Key="SelectionMode"
SubstitutionValue="{x:Bind calendar1.SelectionMode, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="SelectionShape"
SubstitutionValue="{x:Bind calendar1.SelectionShape, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="SelectionHighlightMode"
SubstitutionValue="{x:Bind calendar1.SelectionHighlightMode, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="FirstDayOfWeek"
SubstitutionValue="{x:Bind calendar1.FirstDayOfWeek, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="NumberOfWeeksInView"
SubstitutionValue="{x:Bind calendar1.NumberOfWeeksInView, Mode=OneWay}"/>
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout
HeaderText="Date and View Navigation."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/DateNavigation_xaml.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar2"
MinDisplayMode="{x:Bind viewModel.MinDisplayMode, Mode=TwoWay}"
MaxDisplayMode="{x:Bind viewModel.MaxDisplayMode, Mode=TwoWay}"
MinDate="{x:Bind viewModel.MinDate, Mode=TwoWay}"
MaxDate="{x:Bind viewModel.MaxDate, Mode=TwoWay}"/>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<TextBlock
Margin="5, 5, 5, 2"
Width="180"
Text="MinimumDate"/>
<calendar:SfCalendarDatePicker
Margin="5, 0, 5, 5"
Width="180"
AllowNull="False"
SelectedDate="{x:Bind viewModel.MinDate, Mode=TwoWay}"/>
<TextBlock
Margin="5, 5, 5, 2"
Width="180"
Text="MaximumDate"/>
<calendar:SfCalendarDatePicker
Margin="5, 0, 5, 5"
Width="180"
AllowNull="False"
SelectedDate="{x:Bind viewModel.MaxDate, Mode=TwoWay}"/>
<ComboBox
Margin="5"
Width="180"
Header="MinDisplayMode"
SelectedItem="{Binding MinDisplayMode, Converter={enumextension:StringToEnumValueConverter Type=calendar:CalendarDisplayMode}, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:CalendarDisplayMode}"/>
<ComboBox
Margin="5"
Width="180"
Header="MaxDisplayMode"
SelectedItem="{Binding MaxDisplayMode, Converter={enumextension:StringToEnumValueConverter Type=calendar:CalendarDisplayMode}, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:CalendarDisplayMode}"/>
<ComboBox
Margin="5"
Width="180"
Header="DisplayMode"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=calendar:CalendarDisplayMode}, ElementName=calendar2, Path=DisplayMode, Mode=TwoWay}"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=calendar:CalendarDisplayMode}"/>
<ComboBox
Margin="5"
Width="180"
Header="NavigationDirection"
ItemsSource="{enumextension:EnumToStringValuesExtension Type=Orientation}"
SelectedItem="{Binding Converter={enumextension:StringToEnumValueConverter Type=Orientation}, ElementName=calendar2, Path=NavigationDirection, Mode=TwoWay}" />
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution
Key="CalendarMinDate"
SubstitutionValue="{x:Bind calendar2.MinDate, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarMaxDate"
SubstitutionValue="{x:Bind calendar2.MaxDate, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarMinDisplayMode"
SubstitutionValue="{x:Bind calendar2.MinDisplayMode, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarMaxDisplayMode"
SubstitutionValue="{x:Bind calendar2.MaxDisplayMode, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="DisplayMode"
SubstitutionValue="{x:Bind calendar2.DisplayMode, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="NavigationDirection"
SubstitutionValue="{x:Bind calendar2.NavigationDirection, Mode=OneWay}"/>
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout
HeaderText="Different types of Calendar."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/CalendarTypes_xaml.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar3"/>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<ComboBox
Margin="5"
Width="180"
Header="CalendarIdentifier"
ItemsSource="{Binding Items}"
SelectedItem="{Binding ElementName=calendar3, Path=CalendarIdentifier, Mode=TwoWay}"/>
<ComboBox
x:Name="languages"
Margin="5"
Width="180"
Header="Languages"
DisplayMemberPath="Name"
SelectedValuePath="Code"
ItemsSource="{Binding Languages}"
SelectedIndex="0"
SelectionChanged="languages_SelectionChanged"/>
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution
Key="CalendarIdentifier"
SubstitutionValue="{x:Bind calendar3.CalendarIdentifier, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="Language"
SubstitutionValue="{x:Bind calendar3.Language, Mode=OneWay}"/>
</common:DemoLayout.Substitutions>
</common:DemoLayout>
</StackPanel>
</ScrollViewer>
</Page>

Просмотреть файл

@ -0,0 +1,40 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace syncfusion.calendardemos.winui.Views.Calendar
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CalendarView : Page
{
public CalendarView()
{
this.InitializeComponent();
this.calendarViewPanel.PointerPressed += OnCalendarViewPanelPointerPressed;
}
private void OnCalendarViewPanelPointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{
// To restrict the focus on first control when clicking on empty area.
e.Handled = true;
}
private void languages_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string selectedLang = languages.SelectedValue.ToString();
if (Windows.Globalization.Language.IsWellFormed(selectedLang))
{
calendar3.Language = selectedLang;
}
}
}
}

Просмотреть файл

@ -0,0 +1,169 @@
<Page
x:Class="syncfusion.calendardemos.winui.Views.Calendar.Customization"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:syncfusion.calendardemos.winui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:common="using:syncfusion.demoscommon.winui"
xmlns:calendar="using:Syncfusion.UI.Xaml.Calendar"
xmlns:global="using:System.Globalization"
xmlns:core="using:Syncfusion.UI.Xaml.Core"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<local:DateFormatToDisplayFormatConverter x:Name="dateFormatToDisplayFormatConverter"/>
</Page.Resources>
<Page.DataContext>
<local:CalendarViewModel/>
</Page.DataContext>
<ScrollViewer>
<StackPanel x:Name="customizationViewPanel">
<common:DemoLayout
HeaderText="Date Formatting."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/Formatting_xaml.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar4"
DayFormat="{Binding
ElementName=DayFormat,
Path=SelectedItem,
ConverterParameter='day',
Mode=TwoWay,
Converter={StaticResource dateFormatToDisplayFormatConverter}}"
MonthFormat="{Binding
ElementName=MonthFormat,
Path=SelectedItem,
ConverterParameter='month',
Mode=TwoWay,
Converter={StaticResource dateFormatToDisplayFormatConverter}}"
DayOfWeekFormat="{Binding
ElementName=DayOfWeekFormat,
Path=SelectedItem,
ConverterParameter='dayofweek',
Mode=TwoWay,
Converter={StaticResource dateFormatToDisplayFormatConverter}}"
MonthHeaderFormat="{Binding
ElementName=MonthHeaderFormat,
Path=SelectedItem,
ConverterParameter='header',
Mode=TwoWay,
Converter={StaticResource dateFormatToDisplayFormatConverter}}"/>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<ComboBox
Margin="5"
Width="180"
SelectedIndex="0"
Header="DayFormat"
Name="DayFormat">
<x:String>Abbreviated</x:String>
<x:String>Full</x:String>
</ComboBox>
<ComboBox
Margin="5"
Width="180"
SelectedIndex="0"
Header="MonthFormat"
Name="MonthFormat">
<x:String>Abbreviated</x:String>
<x:String>Full</x:String>
<x:String>Number</x:String>
</ComboBox>
<ComboBox
Margin="5"
Width="180"
SelectedIndex="0"
Header="DayOfWeekFormat"
Name="DayOfWeekFormat">
<x:String>Abbreviated - 2 char</x:String>
<x:String>Abbreviated - 3 char</x:String>
</ComboBox>
<ComboBox
Margin="5"
Width="180"
SelectedIndex="0"
Header="MonthHeaderFormat"
Name="MonthHeaderFormat">
<x:String>Full</x:String>
<x:String>Abbreviated</x:String>
</ComboBox>
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution
Key="CalendarDayFormat"
SubstitutionValue="{x:Bind calendar4.DayFormat, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarMonthFormat"
SubstitutionValue="{x:Bind calendar4.MonthFormat, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarDayOfWeekFormat"
SubstitutionValue="{x:Bind calendar4.DayOfWeekFormat, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="CalendarMonthHeaderFormat"
SubstitutionValue="{x:Bind calendar4.MonthHeaderFormat, Mode=OneWay}"/>
</common:DemoLayout.Substitutions>
</common:DemoLayout>
<common:DemoLayout
HeaderText="Blackout all weekends.">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar5"
ItemPrepared="Blackout_ItemPrepared">
</calendar:SfCalendar>
</common:DemoLayout.Example>
</common:DemoLayout>
<common:DemoLayout
HeaderText="Blackout specific dates."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/BlackoutDates_xaml.txt"
CSharpSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/BlackoutDates_cs.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="calendar6"
BlackoutDates="{Binding BlackoutSpecificDates}"/>
</common:DemoLayout.Example>
</common:DemoLayout>
<common:DemoLayout
HeaderText="Week number."
XamlSource="syncfusion.calendardemos.winui/Views/Calendar/Resources/SourceCodes/WeekNumber_xaml.txt">
<common:DemoLayout.Example>
<calendar:SfCalendar
x:Name="weekNumber"
ShowWeekNumbers="True"
WeekNumberFormat=""/>
</common:DemoLayout.Example>
<common:DemoLayout.Options>
<StackPanel>
<ComboBox
Margin="5"
Width="180"
Header="WeekNumberRule"
ItemsSource="{core:EnumValuesExtension Type=global:CalendarWeekRule}"
SelectedItem="{Binding WeekNumberRule, ElementName=weekNumber, Mode=TwoWay}"/>
<TextBox
Margin="5"
Width="180"
HorizontalAlignment="Left"
PlaceholderText="Try: #, W#, W #, Week#"
Header="WeekNumberFormat"
Text="{Binding WeekNumberFormat, ElementName=weekNumber, Mode=TwoWay}"/>
</StackPanel>
</common:DemoLayout.Options>
<common:DemoLayout.Substitutions>
<common:DemoLayoutSubstitution
Key="WeekNumberRule"
SubstitutionValue="{x:Bind weekNumber.WeekNumberRule, Mode=OneWay}"/>
<common:DemoLayoutSubstitution
Key="WeekNumberFormat"
SubstitutionValue="{x:Bind weekNumber.WeekNumberFormat, Mode=OneWay}"/>
</common:DemoLayout.Substitutions>
</common:DemoLayout>
</StackPanel>
</ScrollViewer>
</Page>

Просмотреть файл

@ -0,0 +1,43 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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 System;
using Microsoft.UI.Xaml.Controls;
using Syncfusion.UI.Xaml.Calendar;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace syncfusion.calendardemos.winui.Views.Calendar
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Customization : Page
{
public Customization()
{
this.InitializeComponent();
this.customizationViewPanel.PointerPressed += OnCustomizationViewPanelPointerPressed;
}
private void OnCustomizationViewPanelPointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{
// To restrict the focus on first control when clicking on empty area.
e.Handled = true;
}
private void Blackout_ItemPrepared(object sender, CalendarItemPreparedEventArgs e)
{
if (e.ItemInfo.ItemType == CalendarItemType.Day &&
(e.ItemInfo.Date.DayOfWeek == DayOfWeek.Saturday ||
e.ItemInfo.Date.DayOfWeek == DayOfWeek.Sunday))
{
e.ItemInfo.IsBlackout = true;
}
}
}
}

Просмотреть файл

@ -0,0 +1,81 @@
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. 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;
using System.Collections.Generic;
using System.Linq;
namespace syncfusion.calendardemos.winui
{
public class CustomCalendarItemTemplateSelector : DataTemplateSelector
{
public CustomCalendarItemTemplateSelector()
{
SpecialDates = new Dictionary<DateTimeOffset, string>();
SpecialDates.Add(DateTimeOffset.Now.AddMonths(-1).AddDays(1), "SingleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(-1).AddDays(5), "DoubleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(-1).AddDays(-2), "TripleEvent_2");
SpecialDates.Add(DateTimeOffset.Now.AddDays(1), "TripleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddDays(5), "SingleEvent_2");
SpecialDates.Add(DateTimeOffset.Now.AddDays(7), "DoubleEvent_2");
SpecialDates.Add(DateTimeOffset.Now.AddDays(9), "SingleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddDays(12), "TripleEvent_2");
SpecialDates.Add(DateTimeOffset.Now.AddDays(-4), "DoubleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(1).AddDays(1), "DoubleEvent_3");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(1).AddDays(3), "SingleEvent_2");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(1).AddDays(-5), "DoubleEvent_2");
}
private Dictionary<DateTimeOffset, string> SpecialDates { get; set; }
public DataTemplate DefaultTemplate { get; set; }
public DataTemplate SingleEventTemplate_1 { get; set; }
public DataTemplate SingleEventTemplate_2 { get; set; }
public DataTemplate DoubleEventTemplate_1 { get; set; }
public DataTemplate DoubleEventTemplate_2 { get; set; }
public DataTemplate DoubleEventTemplate_3 { get; set; }
public DataTemplate TripleEventTemplate_1 { get; set; }
public DataTemplate TripleEventTemplate_2 { get; set; }
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
{
if (item != null)
{
DateTimeOffset calendarItem = (DateTimeOffset)item;
DateTimeOffset dateTimeOffset = SpecialDates.Keys.FirstOrDefault(x => x.Date == calendarItem.Date);
if (dateTimeOffset != DateTimeOffset.MinValue)
{
string template = this.SpecialDates[dateTimeOffset];
switch (template)
{
case "SingleEvent_1":
return SingleEventTemplate_1;
case "SingleEvent_2":
return SingleEventTemplate_2;
case "DoubleEvent_1":
return DoubleEventTemplate_1;
case "DoubleEvent_2":
return DoubleEventTemplate_2;
case "DoubleEvent_3":
return DoubleEventTemplate_3;
case "TripleEvent_1":
return TripleEventTemplate_1;
case "TripleEvent_2":
return TripleEventTemplate_2;
}
}
return DefaultTemplate;
}
return base.SelectTemplateCore(item, container);
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
public class ViewModel
{
public DateTimeOffsetCollection BlackoutSpecificDates { get; set; }
public ViewModel()
{
BlackoutSpecificDates = new DateTimeOffsetCollection();
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(2021, 04, 4)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(2021, 04, 11)));
BlackoutSpecificDates.Add(new DateTimeOffset(new DateTime(2021, 04, 28)));
...
}
}

Просмотреть файл

@ -0,0 +1,2 @@
<calendar:SfCalendar
BlackoutDates="{Binding BlackoutSpecificDates}"/>

Просмотреть файл

@ -0,0 +1,3 @@
<calendar:SfCalendar
CalendarIdentifier="$(CalendarIdentifier)"
Language="$(Language)"/>

Просмотреть файл

@ -0,0 +1,7 @@
<calendar:SfCalendar
MinDate="$(CalendarMinDate)"
MaxDate="$(CalendarMaxDate)"
MinDisplayMode="$(CalendarMinDisplayMode)"
MaxDisplayMode="$(CalendarMaxDisplayMode)"
DisplayMode="$(DisplayMode)"
NavigationDirection="$(NavigationDirection)"/>

Просмотреть файл

@ -0,0 +1,5 @@
<calendar:SfCalendar
DayFormat="$(CalendarDayFormat)"
MonthFormat="$(CalendarMonthFormat)"
DayOfWeekFormat="$(CalendarDayOfWeekFormat)"
MonthHeaderFormat="$(CalendarMonthHeaderFormat)"/>

Просмотреть файл

@ -0,0 +1,39 @@
public class CustomCalendarItemTemplateSelector : DataTemplateSelector
{
public CustomCalendarItemTemplateSelector()
{
SpecialDates = new Dictionary<DateTimeOffset, string>();
SpecialDates.Add(DateTimeOffset.Now.AddMonths(-1).AddDays(1), "SingleEvent_1");
SpecialDates.Add(DateTimeOffset.Now.AddMonths(-1).AddDays(5), "DoubleEvent_1");
...
}
private Dictionary<DateTimeOffset, string> SpecialDates { get; set; }
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
{
if (item != null)
{
DateTimeOffset calendarItem = (DateTimeOffset)item;
DateTimeOffset dateTimeOffset = SpecialDates.Keys.FirstOrDefault(x => x.Date == calendarItem.Date);
if (dateTimeOffset != DateTimeOffset.MinValue)
{
string template = this.SpecialDates[dateTimeOffset];
switch (template)
{
case "SingleEvent_1":
return Application.Current.Resources["singleEventTemplate_1"] as DataTemplate;
case "DoubleEvent_1":
return Application.Current.Resources["doubleEventTemplate_1"] as DataTemplate;
...
}
}
return Application.Current.Resources["defaultTemplate"] as DataTemplate;
}
return base.SelectTemplateCore(item, container);
}
}

Просмотреть файл

@ -0,0 +1,22 @@
<calendar:SfCalendar
DayOfWeekFormat="{}{dayofweek.abbreviated(3)}">
<calendar:SfCalendar.Resources>
<local:CustomCalendarItemTemplateSelector x:Key="selector" />
<Style TargetType="calendar:CalendarItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<ContentControl Content="{Binding DisplayText}"/>
<ContentControl
Content="{Binding Date}"
ContentTemplateSelector="{StaticResource selector}"/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</calendar:SfCalendar.Resources>
</calendar:SfCalendar>

Просмотреть файл

@ -0,0 +1,6 @@
<calendar:SfCalendar
SelectionMode="$(SelectionMode)"
SelectionShape="$(SelectionShape)"
SelectionHighlightMode="$(SelectionHighlightMode)"
FirstDayOfWeek="$(FirstDayOfWeek)"
NumberOfWeeksInView="$(NumberOfWeeksInView)"/>

Просмотреть файл

@ -0,0 +1,31 @@
<calendar:SfCalendar>
<calendar:SfCalendar.Resources>
<ResourceDictionary>
<!--Theme key customization-->
<SolidColorBrush x:Key="SyncfusionCalendarNavigationButtonForeground"
Color="#FF248D92" />
<SolidColorBrush x:Key="SyncfusionCalendarWeekItemForeground"
Color="#FF248D92" />
<SolidColorBrush x:Key="SyncfusionCalendarTodayItemBackground"
Color="#FF9BC5ED" />
<Thickness x:Key="SyncfusionCalendarItemMargin">1.5</Thickness>
<x:Double x:Key="SyncfusionSubtitleAltFontSize">30</x:Double>
...
<Style TargetType="calendar:CalendarItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<ContentControl Content="{Binding DisplayText}"/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</calendar:SfCalendar.Resources>
</calendar:SfCalendar>

Просмотреть файл

@ -0,0 +1,4 @@
<calendar:SfCalendar
ShowWeekNumbers="True"
WeekNumberRule="$(WeekNumberRule)"
WeekNumberFormat="$(WeekNumberFormat)"/>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше