Exemplo n.º 1
0
        /// <summary>
        /// Create main button element that is specific for RadRepeatButton.
        /// </summary>
        /// <returns>The element that encapsulates the funtionality of RadRepeatButton</returns>
        protected override RadButtonElement CreateButtonElement()
        {
            RadRepeatButtonElement res = new RadRepeatButtonElement();

            res.UseNewLayoutSystem = true;
            return(res);
        }
        protected override void DisposeManagedResources()
        {
            this.Calendar.PropertyChanged -= new PropertyChangedEventHandler(Calendar_PropertyChanged);

            this.View     = null;
            this.Calendar = null;

            if (this.prevButton != null)
            {
                this.prevButton.Click -= new EventHandler(prevButton_Click);
                this.prevButton.Dispose();
                this.prevButton = null;
            }

            if (this.nextButton != null)
            {
                this.nextButton.Click -= new EventHandler(nextButton_Click);
                this.nextButton.Dispose();
                this.nextButton = null;
            }

            if (this.fastBackwardButton != null)
            {
                this.fastBackwardButton.MouseDown -= new MouseEventHandler(fastBackwardButton_MouseDown);
                this.fastBackwardButton.Dispose();
                this.fastBackwardButton = null;
            }

            if (this.fastForwardButton != null)
            {
                this.fastForwardButton.MouseDown -= new MouseEventHandler(fastForwardButton_MouseDown);
                this.fastForwardButton.Dispose();
                this.fastForwardButton = null;
            }

            this.DisposeNavigationElements();

            base.DisposeManagedResources();
        }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            this.boxLayout                     = new BoxLayout();
            this.boxLayout.Orientation         = System.Windows.Forms.Orientation.Horizontal;
            this.boxLayout.StretchHorizontally = true;
            this.boxLayout.StretchVertically   = false;
            this.boxLayout.RightToLeft         = false;

            this.fastForwardButton = new RadButtonElement();
            this.fastForwardButton.DisplayStyle        = DisplayStyle.Image;
            this.fastForwardButton.ThemeRole           = "FastNavigateForwardButton";
            this.fastForwardButton.StretchHorizontally = false;
            this.fastForwardButton.StretchVertically   = false;
            this.fastForwardButton.SetValue(BoxLayout.StripPositionProperty, BoxLayout.StripPosition.Last);
            this.fastForwardButton.MouseDown += new MouseEventHandler(fastForwardButton_MouseDown);
            this.fastForwardButton.Class      = "fastForwardButton";
            this.fastForwardButton.Children[1].Children[0].Class = "fastForwardButton";
            this.fastForwardButton.MinSize                = new Size(16, 16);
            this.fastForwardButton.ShowBorder             = false;
            this.fastForwardButton.Children[1].Alignment  = ContentAlignment.MiddleCenter;
            this.fastForwardButton.Children[0].Visibility = ElementVisibility.Hidden;
            this.boxLayout.Children.Add(this.fastForwardButton);

            this.nextButton = new RadRepeatButtonElement();
            this.nextButton.DisplayStyle        = DisplayStyle.Image;
            this.nextButton.ThemeRole           = "NavigateForwardButton";
            this.nextButton.StretchHorizontally = false;
            this.nextButton.StretchVertically   = false;
            this.nextButton.SetValue(BoxLayout.StripPositionProperty, BoxLayout.StripPosition.Last);
            this.nextButton.Click += new EventHandler(nextButton_Click);
            this.nextButton.Class  = "nextButton";
            this.nextButton.Children[1].Children[0].Class = "nextButton";
            this.nextButton.MinSize = new Size(16, 16);
            this.nextButton.Children[1].Alignment  = ContentAlignment.MiddleCenter;
            this.nextButton.ShowBorder             = false;
            this.nextButton.Children[0].Visibility = ElementVisibility.Hidden;
            this.boxLayout.Children.Add(this.nextButton);

            this.fastBackwardButton = new RadButtonElement();
            this.fastBackwardButton.DisplayStyle        = DisplayStyle.Image;
            this.fastBackwardButton.ThemeRole           = "FastNavigateBackwardButton";
            this.fastBackwardButton.StretchHorizontally = false;
            this.fastBackwardButton.StretchVertically   = false;
            this.fastBackwardButton.MouseDown          += new MouseEventHandler(fastBackwardButton_MouseDown);
            this.fastBackwardButton.SetValue(BoxLayout.StripPositionProperty, BoxLayout.StripPosition.First);
            this.fastBackwardButton.Class = "fastBackwardButton";
            this.fastBackwardButton.Children[1].Children[0].Class = "fastBackwardButton";
            this.fastBackwardButton.MinSize                = new Size(16, 16);
            this.fastBackwardButton.ShowBorder             = false;
            this.fastBackwardButton.Children[0].Visibility = ElementVisibility.Hidden;
            this.fastBackwardButton.Children[1].Alignment  = ContentAlignment.MiddleCenter;
            this.boxLayout.Children.Add(this.fastBackwardButton);

            this.prevButton = new RadRepeatButtonElement();
            this.prevButton.DisplayStyle        = DisplayStyle.Image;
            this.prevButton.ThemeRole           = "NavigateBackwardButton";
            this.prevButton.StretchHorizontally = false;
            this.prevButton.StretchVertically   = false;
            this.prevButton.Click += new EventHandler(prevButton_Click);
            this.prevButton.Class  = "prevButton";
            this.prevButton.Children[1].Children[0].Class = "prevButton";
            this.prevButton.SetValue(BoxLayout.StripPositionProperty, BoxLayout.StripPosition.First);
            this.prevButton.MinSize = new Size(16, 16);
            this.prevButton.Children[1].Alignment  = ContentAlignment.MiddleCenter;
            this.prevButton.ShowBorder             = false;
            this.prevButton.Children[0].Visibility = ElementVisibility.Hidden;
            this.boxLayout.Children.Add(this.prevButton);

            this.Children.Add(this.boxLayout);
        }