コード例 #1
0
            void OnCalendarViewDayItemChanging(object sender,
                                               CalendarViewDayItemChangingEventArgs e)
            {
                // phase 2: set density bar
                // phase 5: blackout
                // phase 7: end cic event

                if (e.Phase == 2)
                {
                    ColorCollection colors = new ColorCollection();
                    colors.Append(Colors.Red);
                    colors.Append(Colors.Green);
                    colors.Append(Colors.Blue);
                    colors.Append(Colors.Yellow);
                    e.Item.SetDensityColors(colors);
                }
                else if (e.Phase == 5)
                {
                    e.Item.IsBlackout = true;
                }
                else if (e.Phase == 7)
                {
                    m_cicEvent.Set();
                }

                // keep subscribing cic event until phase 7.
                if (e.Phase < 7)
                {
                    e.RegisterUpdateCallback(
                        (sender, e) =>
                    {
                        OnCalendarViewDayItemChanging(sender, e);
                    });
                }
            }