Version

Adding xamMonthCalendar to Your Page

Before You Begin

You can add xamMonthCalendar™ to a Window using the same pattern as any control found in Microsoft® Windows® Presentation Foundation. This pattern involves using a layout container as the main content of the Window and then adding the control to the Children collection of the layout container. It is important to name the layout container in XAML so that you can reference it from the code-behind.

What You Will Accomplish

You will add xamMonthCalendar to your page.

Follow these Steps

  1. Create a Microsoft® Windows® Presentation Foundation Window project.

  2. Add a reference to the following NuGet package:

    • Infragistics.WPF.Editors

    For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

  1. Name the default Grid layout panel in the Window so that you can reference it in the code-behind.

In XAML:

<Grid Name="layoutRoot">
</Grid>
  1. Attach an event handler to the Window’s Loaded event if you are going to add the xamMonthCalendar using code-behind.

In XAML:

<Window ... Loaded="Window_Loaded">
  1. Place using/Imports directives so you don’t have to type out a member’s fully qualified name.

In XAML:

xmlns:igEditors="http://infragistics.com/Editors"

In Visual Basic:

Imports Infragistics.Windows.Editors

In C#:

using Infragistics.Windows.Editors;
  1. Create a xamMonthCalendar control and add it to the main grid.

In XAML:

<igEditors:XamMonthCalendar Name="xamMonthCalendar1">
</igEditors:XamMonthCalendar>

In Visual Basic:

Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Private xamMonthCalendar1 As XamMonthCalendar
    xamMonthCalendar1 = New XamMonthCalendar()
    Me.layoutRoot.Children.Add(xamMonthCalendar1)
End Sub

In C#:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    private XamMonthCalendar xamMonthCalendar1;
    xamMonthCalendar1 = new XamMonthCalendar();
    this.layoutRoot.Children.Add(xamMonthCalendar1);
}
  1. Run the project.

You should see a Window that looks similar to the screen shot below.

xamMonthCalendar Adding xamMonthCalendar to a Window Using XAML 01.png