Inheritance: System.Windows.Controls.ListBox
コード例 #1
0
ファイル: MonthCalendar.cs プロジェクト: liuxr/wpfumprototype
 /// <summary>
 /// Clear our layout-specific data, and detach our current itemscontrol from monthcalendar
 /// </summary>
 private void DetachFromVisualTree()
 {
     if (_mccContainer != null)
     {
         _mccContainer.LayoutUpdated -= new EventHandler(OnContainerLayoutUpdated);
         _mccContainer.SelectionChanged -= new SelectionChangedEventHandler(OnContainerSelectionChanged);
         _mccContainer = null;
     }
 }
コード例 #2
0
ファイル: MonthCalendar.cs プロジェクト: liuxr/wpfumprototype
        /// <summary>
        /// Walk to visual tree to find the MonthCalendarContainer. Set the GroupFactory and GroupPanel.
        /// Register the selection change event if it is a Selector.
        /// </summary>
        private void AttachToVisualTree()
        {
            DetachFromVisualTree();

            // Walk the visual tree to find the MonthCalendarContainer.
            _mccContainer = GetTemplateChild(c_VisibleDaysHostTemplateName) as MonthCalendarContainer;

            if (_mccContainer != null)
            {
                _mccContainer.ItemsSource = VisibleDays;

                RefreshDayTemplate();

                _mccContainer.LayoutUpdated += new EventHandler(OnContainerLayoutUpdated);
                _mccContainer.SelectionChanged += new SelectionChangedEventHandler(OnContainerSelectionChanged);
                //If MonthCalendar's visualtree is restyled, set this flag to true to update the SelectedDates on new UI
                SetFlag(Flags.IsVisualTreeUpdated, true);
            }

            RefreshPreviousButtonStyle();
            RefreshNextButtonStyle();
        }