Version

ReferenceGroupOffset Property

Returns or sets an integer that is used to calculate the dates displayed within the group based on the ReferenceDate of the containing XamMonthCalendar.
Syntax
'Declaration
 
Public Property ReferenceGroupOffset As Integer
public int ReferenceGroupOffset {get; set;}
Remarks

The ReferenceGroupOffset is used to calculate what range of dates should be displayed by the group. It is used along with the ReferenceDate and CurrentCalendarMode when calculating the FirstDateOfGroup and LastDateOfGroup.

By default, the template of the XamMonthCalendar contains a CalendarItemGroupPanel which creates CalendarItemGroup instances based on the CalendarDimensions. It initializes this property such that the first displayed group has a ReferenceGroupOffset of 0 and therefore contains the ReferenceDate. All subsequent groups are offset positively by 1 so that they show the next group worth of dates. If you retemplate the XamMonthCalendar to directly contain CalendarItemGroups then you must set this property. For example, you might have 3 groups whose ReferenceGroupOffsets are -1, 0 and 1. When the ReferenceDate is August 1 2008 and the CurrentCalendarMode is days, the group with -1 would display the dates for July 2008 and the group with 1 would display the dates for September 2008.

Example
The following sample demonstrates how to use the ReferenceGroupOffset when siting CalendarItemGroups directly within the template of the XamMonthCalendar instead of using a CalendarItemGroupPanel.

<UserControl x:Class="Xaml.UserControl1"
    
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
xmlns:sys="clr-namespace:System;assembly=mscorlib"
    
xmlns:igEditors="http://infragistics.com/Editors"
    
xmlns:igThemes="http://infragistics.com/Themes">
    
<UserControl.Resources>
        
<ControlTemplate x:Key="PreviewNextPreviousMonths" TargetType="{x:Type igEditors:XamMonthCalendar}">
            
<Border>
                
<DockPanel>
                    
<ToolBar DockPanel.Dock="Bottom">
                        
<Button Command="{x:Static igEditors:MonthCalendarCommands.ScrollPreviousGroup}" 
                                
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                
Content="&lt;" />
                        
<Button Command="{x:Static igEditors:MonthCalendarCommands.ScrollNextGroup}" 
                                
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                
Content="&gt;" />
                        
<Button DockPanel.Dock="Bottom"
                            
Style="{DynamicResource {x:Static igEditors:XamMonthCalendar.TodayButtonStyleKey}}"
                            
Visibility="{TemplateBinding TodayButtonVisibility}" />
                    
</ToolBar>
                    
<Grid DockPanel.Dock="Top">
                        
<Grid.ColumnDefinitions>
                            
<ColumnDefinition MaxWidth="200" />
                            
<ColumnDefinition />
                            
<ColumnDefinition MaxWidth="200" />
                        
</Grid.ColumnDefinitions>
                        
<Viewbox StretchDirection="DownOnly">
                            
<igEditors:CalendarItemGroup 
                                
ReferenceGroupOffset="-1" 
                                
ScrollNextButtonVisibility="Hidden"
                                
ScrollPreviousButtonVisibility="Hidden"
                                
ShowLeadingDates="{TemplateBinding ShowLeadingAndTrailingDates}"
                                
ShowTrailingDates="False"
                                
/>
                        
</Viewbox>
                        
<Viewbox StretchDirection="DownOnly" Grid.Column="2">
                            
<igEditors:CalendarItemGroup 
                                
ReferenceGroupOffset="1" 
                                
ScrollNextButtonVisibility="Hidden"
                                
ScrollPreviousButtonVisibility="Hidden"
                                
ShowTrailingDates="{TemplateBinding ShowLeadingAndTrailingDates}"
                                
ShowLeadingDates="False"
                                
/>
                        
</Viewbox>
                    
</Grid>
                    
<igEditors:CalendarItemGroup 
                        
HorizontalAlignment="Stretch"
                        
VerticalAlignment="Stretch"
                        
ReferenceGroupOffset="0"
                        
ShowLeadingDates="False"
                        
ShowTrailingDates="False"
                        
/>
                
</DockPanel>
            
</Border>
        
</ControlTemplate>
    
</UserControl.Resources>
    
<igEditors:XamMonthCalendar
        
x:Name="xamMonthCalendar1"
        
Template="{StaticResource PreviewNextPreviousMonths}" />
</UserControl>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also