Microsoft.Samples.KMoore.WPFSamples.DateControls.MonthCalendar.AddToDictionary C# (CSharp) Method

AddToDictionary() private method

Add value to data source dictionary
private AddToDictionary ( object value ) : void
value object
return void
        private void AddToDictionary(object value)
        {
            DateTime? key = GetKeyFromDataSourceItem(value);
            if (key.HasValue && !_dictDataSource.ContainsKey(key.Value))
            {
                // Add date/data pair to data source dictionary, if the date is within current display dates,
                // update CalendarDate.Data immediatelly
                _dictDataSource.Add(key.Value, value);
                if (MonthCalendarHelper.IsWithinRange(key.Value, FirstVisibleDate, LastVisibleDate))
                {
                    CalendarDate cdate = GetCalendarDateByDate(key.Value);
                    cdate.Data = value;
                }
            }
        }