Exemple #1
0
        public override bool EndEdit()
        {
            base.EndEdit();
            RadDateTimePickerElement editorElement  = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement        textBoxElement = (RadTextBoxElement)editorElement.TextBoxElement;

            editorElement.ValueChanging -= new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  -= new EventHandler(this.RadDateTimeEditor_ValueChanged);
            RadDateTimePickerCalendar currentBehavior = editorElement.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (currentBehavior != null)
            {
                currentBehavior.PopupControl.Opened -= new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed -= new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click -= new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click -= new EventHandler(this.TodayButton_Click);
            }
            if (textBoxElement != null)
            {
                textBoxElement.KeyDown -= new KeyEventHandler(this.TextBoxElement_KeyDown);
                textBoxElement.KeyUp   -= new KeyEventHandler(this.textBoxElement_KeyUp);
            }
            (editorElement.GetCurrentBehavior() as RadDateTimePickerCalendar)?.PopupControl.Hide();
            return(true);
        }
Exemple #2
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            this.converter = TypeDescriptor.GetConverter(typeof(Color));

            this.stack                          = new StackLayoutElement();
            this.stack.Orientation              = Orientation.Horizontal;
            this.stack.StretchVertically        = true;
            this.stack.FitInAvailableSize       = true;
            this.stack.StretchHorizontally      = true;
            this.stack.ShouldHandleMouseInput   = false;
            this.stack.NotifyParentOnMouseInput = true;
            this.stack.ElementSpacing           = 1;

            this.colorBox          = this.CreateColorBoxElement();
            this.colorTextBox      = this.CreateColorTextBoxElement();
            this.colorPickerButton = this.CreateColorPickerButtonElement();

            this.stack.Children.Add(this.colorBox);
            this.stack.Children.Add(this.colorTextBox);
            this.stack.Children.Add(this.colorPickerButton);

            this.Children.Add(this.stack);

            this.WireEvents();
        }
Exemple #3
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.stack = this.CreateStackLayoutElement();
     this.messagesViewElement     = this.CreateMessagesListView();
     this.overlayPopupElement     = this.CreateOverlayPopupElement();
     this.suggestedActionsElement = this.CreateSuggestedActionsElement();
     this.inputTextBox            = this.CreateInputTextBox();
     this.toolbarElement          = this.CreateToolbarElement();
     this.typingIndicator         = this.CreateTypingIndicatorElement();
     this.showToolbarButton       = this.CreateShowToolbarButton();
     this.sendButton = this.CreateSendButton();
     this.inputTextBox.ButtonsStack.Children.Add((RadElement)this.showToolbarButton);
     this.inputTextBox.ButtonsStack.Children.Add((RadElement)this.sendButton);
     this.stack.Children.Add((RadElement)this.messagesViewElement);
     this.stack.Children.Add((RadElement)this.overlayPopupElement);
     this.stack.Children.Add((RadElement)this.suggestedActionsElement);
     this.stack.Children.Add((RadElement)this.typingIndicator);
     this.stack.Children.Add((RadElement)this.inputTextBox);
     this.stack.Children.Add((RadElement)this.toolbarElement);
     this.Children.Add((RadElement)this.stack);
     this.overlayElement            = new LightVisualElement();
     this.overlayElement.Visibility = ElementVisibility.Collapsed;
     this.Children.Add((RadElement)this.overlayElement);
 }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();

            this.openFileDialog = new OpenFileDialog();

            this.stack                          = new StackLayoutElement();
            this.stack.Orientation              = Orientation.Horizontal;
            this.stack.StretchVertically        = true;
            this.stack.FitInAvailableSize       = true;
            this.stack.StretchHorizontally      = true;
            this.stack.ShouldHandleMouseInput   = false;
            this.stack.NotifyParentOnMouseInput = true;
            this.stack.ElementSpacing           = 1;

            this.filePathTextBox      = this.CreateFilePathTextBoxElement();
            this.openFileDialogButton = this.CreateOpenFileDialogButtonElement();

            this.stack.Children.Add(this.filePathTextBox);
            this.stack.Children.Add(this.openFileDialogButton);

            this.Children.Add(this.stack);

            this.WireEvents();
        }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.arrowButton = this.CreateArrowButtonElement();
            int num1 = (int)this.arrowButton.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Collapsed);

            this.arrowButton.ClickMode           = ClickMode.Press;
            this.arrowButton.Click              += new EventHandler(this.arrow_Click);
            this.arrowButton.ZIndex              = 1;
            this.arrowButton.StretchHorizontally = false;
            this.arrowButton.StretchVertically   = true;
            this.borderPrimitive       = new BorderPrimitive();
            this.borderPrimitive.Class = "DropDownListBorder";
            this.Children.Add((RadElement)this.borderPrimitive);
            this.fillPrimitive                     = new FillPrimitive();
            this.fillPrimitive.Class               = "DropDownFill";
            this.fillPrimitive.ZIndex              = -1;
            this.fillPrimitive.RadPropertyChanged += new RadPropertyChangedEventHandler(this.fillPrimitive_RadPropertyChanged);
            this.Children.Add((RadElement)this.fillPrimitive);
            StackLayoutElement stackLayoutElement = new StackLayoutElement();

            stackLayoutElement.CanFocus            = false;
            stackLayoutElement.StretchVertically   = true;
            stackLayoutElement.StretchHorizontally = true;
            stackLayoutElement.Class = "DropDownListStack";
            stackLayoutElement.FitInAvailableSize = true;
            this.Children.Add((RadElement)stackLayoutElement);
            this.containerElement           = new RadDropDownListEditableAreaElement((RadDropDownListElement)null);
            this.editableElement            = (RadTextBoxElement)this.containerElement.TextBox;
            this.editableElement.Visibility = ElementVisibility.Hidden;
            this.containerElement.DrawText  = true;
            stackLayoutElement.Children.Add((RadElement)this.containerElement);
            stackLayoutElement.Children.Add((RadElement)this.arrowButton);
            int num2 = (int)this.BindProperty(RadItem.TextProperty, (RadObject)this.editableElement, RadItem.TextProperty, PropertyBindingOptions.TwoWay);
        }
Exemple #6
0
 protected internal override void InitializeTextElement()
 {
     this.textBoxElement = this.CreateTextBoxElement();
     this.textBoxElement.StretchVertically = true;
     this.textBoxElement.ShowBorder        = true;
     this.textBoxElement.ShowClearButton   = false;
 }
        public override bool EndEdit()
        {
            base.EndEdit();
            RadDateTimePickerElement editor         = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement        textBoxElement = editor.TextBoxElement;

            editor.ValueChanging -= new ValueChangingEventHandler(RadDateTimeEditor_ValueChanging);
            editor.ValueChanged  -= new EventHandler(RadDateTimeEditor_ValueChanged);
            RadDateTimePickerCalendar dateTimeBehavior = editor.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (dateTimeBehavior != null)
            {
                dateTimeBehavior.PopupControl.Opened -= new EventHandler(PopupControl_Opened);
                dateTimeBehavior.PopupControl.Closed -= new RadPopupClosedEventHandler(PopupControl_Closed);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click -= new EventHandler(ClearButton_Click);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click -= new EventHandler(TodayButton_Click);
            }
            if (textBoxElement != null)
            {
                textBoxElement.KeyDown -= new KeyEventHandler(TextBoxElement_KeyDown);
                textBoxElement.TextBoxItem.HostedControl.LostFocus -= new EventHandler(HostedControl_LostFocus);
            }
            RadDateTimePickerCalendar calendar = editor.GetCurrentBehavior() as RadDateTimePickerCalendar;

            if (calendar != null)
            {
                calendar.PopupControl.Hide();
            }
            return(true);
        }
Exemple #8
0
        protected virtual RadTextBoxElement CreateInputTextBox()
        {
            RadTextBoxElement radTextBoxElement = (RadTextBoxElement) new ChatInputTextBoxElement();

            radTextBoxElement.StretchVertically    = false;
            radTextBoxElement.TextBoxItem.NullText = LocalizationProvider <ChatLocalizationProvider> .CurrentProvider.GetLocalizedString("TypeAMessage");

            return(radTextBoxElement);
        }
        protected virtual RadTextBoxElement CreateFilePathTextBoxElement()
        {
            RadTextBoxElement element = new RadTextBoxElement();

            element.StretchHorizontally = true;
            element.StretchVertically   = true;

            return(element);
        }
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.StretchHorizontally    = this.StretchVertically = false;
     this.textBoxElement         = new RadTextBoxElement();
     this.textBoxElement.MinSize = new System.Drawing.Size(60, 22);
     this.textBoxElement.Class   = "RadCommandBarTextBoxElement";
     this.Children.Add(this.textBoxElement);
 }
Exemple #11
0
 /// <summary>
 /// Initializes textbox's children
 /// </summary>
 protected override internal void InitializeTextElement()
 {
     if (this.textElementInitialized)
     {
         return;
     }
     this.textBoxElement            = new RadTextBoxElement();
     this.textBoxElement.ShowBorder = true;
     this.textElementInitialized    = true;
 }
Exemple #12
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.StretchHorizontally      = this.StretchVertically = false;
     this.textBoxElement           = new RadTextBoxElement();
     this.textBoxElement.MinSize   = new Size(60, 22);
     this.textBoxElement.Class     = "RadCommandBarTextBoxElement";
     this.textBoxElement.Alignment = ContentAlignment.MiddleLeft;
     this.Children.Add((RadElement)this.textBoxElement);
 }
Exemple #13
0
        protected virtual RadTextBoxElement CreateColorTextBoxElement()
        {
            RadTextBoxElement element = new RadTextBoxElement();

            element.StretchHorizontally      = true;
            element.StretchVertically        = true;
            element.NotifyParentOnMouseInput = true;

            return(element);
        }
        public override void BeginEdit()
        {
            this.Value = this.initialValue;

            base.BeginEdit();

            //This is need to always make selected the first part ot date mask when the editor is opened
            RadDateTimePickerElement  editor           = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement   = editor.TextBoxElement;
            RadDateTimePickerCalendar dateTimeBehavior = editor.CurrentBehavior as RadDateTimePickerCalendar;

            editor.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editor.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editor.TextBoxElement.TextBoxItem.SelectionLength = 1;

            if (dateTimeBehavior != null)
            {
                dateTimeBehavior.DropDownMinSize = new Size(editor.Size.Width, 200);
                RadMaskedEditBoxElement maskTextBox = editor.TextBoxElement as RadMaskedEditBoxElement;
                MaskDateTimeProvider    maskHandler = (MaskDateTimeProvider)maskTextBox.Provider;
                maskHandler.SelectFirstEditableItem();
                this.selectedItemIndex = maskHandler.SelectedItemIndex;
                //int lastCaretPos = maskHandler.;
                //int lastSelectionPos = maskHandler.SelectionPosition;
                //while (maskHandler.SelectionPosition >= 0)
                //{
                //    lastSelectionPos = maskHandler.SelectionPosition;
                //    maskHandler.HandleLeftKey();
                //    if (lastSelectionPos == maskHandler.SelectionPosition)
                //        break;
                //}
                //this.selectedItemIndex = maskHandler.SelectedFormatInfoIndex;
                //maskTextBox.SelectionLength = maskHandler.SelectionLength;

                dateTimeBehavior.PopupControl.Opened += new EventHandler(PopupControl_Opened);
                dateTimeBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(PopupControl_Closed);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(ClearButton_Click);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(TodayButton_Click);

                if (editor.Value == editor.NullDate)
                {
                    maskTextBox.Text = String.Empty;
                }
            }

            editor.NotifyParentOnMouseInput = false;
            editor.BackColor      = Color.White;
            editor.ValueChanging += new ValueChangingEventHandler(RadDateTimeEditor_ValueChanging);
            editor.ValueChanged  += new EventHandler(RadDateTimeEditor_ValueChanged);

            if (textBoxElement != null)
            {
                textBoxElement.KeyDown += new KeyEventHandler(TextBoxElement_KeyDown);
            }
        }
Exemple #15
0
        protected virtual RadTextBoxElement CreateFilterTextBox()
        {
            RadTextBoxElement radTextBoxElement = new RadTextBoxElement();

            radTextBoxElement.StretchHorizontally  = true;
            radTextBoxElement.ShowClearButton      = true;
            radTextBoxElement.TextBoxItem.NullText = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ColumnChooserFilterTextBoxNullText");

            radTextBoxElement.Visibility = ElementVisibility.Collapsed;
            return(radTextBoxElement);
        }
Exemple #16
0
        public override void BeginEdit()
        {
            this.Value = this.initialValue;
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.SelectAll();
            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                if (editorElement.TextBoxElement.MaskType != MaskType.FreeFormDateTime)
                {
                    provider.SelectFirstEditableItem();
                }
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 != null)
            {
                textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
                textBoxElement1.KeyUp   += new KeyEventHandler(this.textBoxElement_KeyUp);
            }
            if (editorElement.ElementTree != null)
            {
                RadControl control = editorElement.ElementTree.Control as RadControl;
                if (control != null && control.ThemeName == "TelerikMetroTouch" || ThemeResolutionService.ApplicationThemeName == "TelerikMetroTouch")
                {
                    editorElement.CalendarSize = new Size(300, 300);
                }
            }
            this.isValidated = false;
        }
        private RadItem CreateFakeItem(RadItem item)
        {
            if (item as RadButtonElement != null)
            {
                RadButtonElement element = new RadButtonElement();
                element.Text       = item.Text;
                element.Font       = item.Font;
                element.Image      = (item as RadButtonElement).Image;
                element.ImageIndex = (item as RadButtonElement).ImageIndex;
                element.ImageKey   = (item as RadButtonElement).ImageKey;

                return(element);
            }

            if (item as RadComboBoxElement != null)
            {
                RadComboBoxElement element = new RadComboBoxElement();
                element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
                element.Text         = item.Text;
                element.Font         = item.Font;
                return(element);
            }

            if (item as RadTextBoxElement != null)
            {
                RadTextBoxElement element = new RadTextBoxElement();
                element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
                element.Text         = item.Text;
                element.Font         = item.Font;
                return(element);
            }

            if (item as RadDropDownButtonElement != null)
            {
                RadDropDownButtonElement element = new RadDropDownButtonElement();
                element.Text       = item.Text;
                element.Image      = (item as RadDropDownButtonElement).Image;
                element.ImageIndex = (item as RadDropDownButtonElement).ImageIndex;
                element.ImageKey   = (item as RadDropDownButtonElement).ImageKey;
                return(element);
            }

            return(null);
        }
Exemple #18
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editorElement.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editorElement.TextBoxElement.TextBoxItem.SelectionLength = 1;
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                provider.SelectFirstEditableItem();
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!BaseTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 == null)
            {
                return;
            }
            textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
            textBoxElement1.TextBoxItem.HostedControl.LostFocus += new EventHandler(this.HostedControl_LostFocus);
        }
Exemple #19
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.scrollViewer = new RadScrollViewer();
            this.scrollViewer.StretchHorizontally = true;
            this.scrollViewer.StretchVertically   = true;
            this.scrollViewer.ShowBorder          = false;
            this.scrollViewer.ShowFill            = false;
            this.Children.Add((RadElement)this.scrollViewer);
            this.panel                     = new StackLayoutElement();
            this.panel.Orientation         = Orientation.Vertical;
            this.panel.StretchHorizontally = true;
            this.panel.StretchVertically   = true;
            LightVisualElement lightVisualElement = new LightVisualElement();

            lightVisualElement.Children.Add((RadElement)this.panel);
            this.scrollViewer.Viewport = (RadElement)lightVisualElement;
            this.filterTextBox         = this.CreateFilterTextBox();
            this.Children.Add((RadElement)this.filterTextBox);
        }
 public void ItemChanged(
     RadItemCollection changed,
     RadItem target,
     ItemsChangeOperation operation)
 {
     if (operation == ItemsChangeOperation.Inserted || operation == ItemsChangeOperation.Removed)
     {
         this.ResetItemsIsAtUnevenIndexProperty();
     }
     this.invalidateCollapsableChildrenCollection = true;
     if (operation != ItemsChangeOperation.Inserted && operation != ItemsChangeOperation.Set)
     {
         return;
     }
     target.NotifyParentOnMouseInput = true;
     if ((object)target.GetType() == (object)typeof(RadButtonElement))
     {
         RadButtonElement target1 = target as RadButtonElement;
         target1.ButtonFillElement.Class = "ButtonInRibbonFill";
         target1.ThemeRole = "ButtonInRibbonButtonGroup";
         this.SynchShowBorder(target1);
         if (this.ElementTree != null)
         {
             this.ElementTree.ApplyThemeToElement((RadObject)target1);
         }
     }
     if ((object)target.GetType() == (object)typeof(RibbonBarGroupSeparator))
     {
         int num1 = (int)target.SetDefaultValueOverride(RibbonBarGroupSeparator.OrientationProperty, (object)this.Orientation);
     }
     if (target is RadRibbonBarButtonGroup)
     {
         int num2 = (int)target.SetDefaultValueOverride(RadElement.MinSizeProperty, (object)new Size(22, 22));
     }
     if (target is RadDropDownListElement)
     {
         int num3 = (int)target.SetDefaultValueOverride(RadElement.MinSizeProperty, (object)new Size(140, 0));
         int num4 = (int)target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, (object)RadAutoSizeMode.WrapAroundChildren);
     }
     if (target is RadTextBoxElement)
     {
         RadTextBoxElement radTextBoxElement = (RadTextBoxElement)target;
         int     num3    = (int)target.SetDefaultValueOverride(RadElement.MinSizeProperty, (object)new Size(140, 0));
         int     num4    = (int)target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, (object)RadAutoSizeMode.WrapAroundChildren);
         Padding padding = radTextBoxElement.Padding;
         padding.Left              = 0;
         padding.Right             = 0;
         radTextBoxElement.Padding = padding;
         int num5 = (int)radTextBoxElement.SetDefaultValueOverride(RadElement.PaddingProperty, (object)padding);
     }
     if (target is RadGalleryElement)
     {
         int num6 = (int)target.SetDefaultValueOverride(RadElement.PaddingProperty, (object)new Padding(2, 2, 0, 0));
     }
     if (target is RadSplitButtonElement)
     {
         int num3 = (int)target.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
         int num4 = (int)target.Children[0].SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Hidden);
     }
     if (target is RadCheckBoxElement)
     {
         int num7 = (int)target.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
     }
     if (!(target is RadRadioButtonElement))
     {
         return;
     }
     int num8 = (int)target.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
     int num9 = (int)target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, (object)RadAutoSizeMode.WrapAroundChildren);
 }
        /// <summary>
        /// Fires ItemChanged event.
        ///</summary>
        public void ItemChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            if (operation == ItemsChangeOperation.Inserted || operation == ItemsChangeOperation.Removed)
            {
                this.ResetItemsIsAtUnevenIndexProperty();
            }

            this.invalidateCollapsableChildrenCollection = true;
            if (operation == ItemsChangeOperation.Inserted ||
                operation == ItemsChangeOperation.Set)
            {
                target.NotifyParentOnMouseInput = true;
                if (target.GetType() == typeof(RadButtonElement))
                {
                    RadButtonElement buttonElement = target as RadButtonElement;
                    buttonElement.ButtonFillElement.Class = "ButtonInRibbonFill";
                    buttonElement.ThemeRole = "ButtonInRibbonButtonGroup";
                    SynchShowBorder(buttonElement);
                }

                if (target.GetType() == typeof(RibbonBarGroupSeparator))
                {
                    target.SetDefaultValueOverride(RibbonBarGroupSeparator.OrientationProperty, this.Orientation);
                }

                if (target is RadRibbonBarButtonGroup)
                {
                    RadRibbonBarButtonGroup buttonGroup = (RadRibbonBarButtonGroup)target;
                    buttonGroup.SetDefaultValueOverride(RadElement.MinSizeProperty, new Size(22, 22));
                }
                if (target is RadComboBoxElement || target is RadDropDownListElement)
                {
                    target.SetDefaultValueOverride(RadElement.MinSizeProperty, new Size(140, 0));
                    target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, RadAutoSizeMode.WrapAroundChildren);
                }
                if (target is RadTextBoxElement)
                {
                    RadTextBoxElement textBoxElement = (RadTextBoxElement)target;
                    target.SetDefaultValueOverride(RadElement.MinSizeProperty, new Size(140, 0));
                    target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, RadAutoSizeMode.WrapAroundChildren);
                    //// The border size is more correct in without horizontal padding
                    Padding temp = textBoxElement.Padding;
                    temp.Left              = 0;
                    temp.Right             = 0;
                    textBoxElement.Padding = temp;
                    textBoxElement.SetDefaultValueOverride(RadElement.PaddingProperty, temp);
                }
                if (target is RadGalleryElement)
                {
                    target.SetDefaultValueOverride(RadElement.PaddingProperty, new Padding(2, 2, 0, 0));
                }
                if (target is RadSplitButtonElement)
                {
                    target.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, false);
                    target.Children[0].SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Hidden);
                }
                if (target is RadCheckBoxElement)
                {
                    target.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, false);
                }
                if (target is RadRadioButtonElement)
                {
                    target.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, false);
                    target.SetDefaultValueOverride(RadElement.AutoSizeModeProperty, RadAutoSizeMode.WrapAroundChildren);
                }
            }
        }
Exemple #22
0
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(Control previewSurface)
        {
            RadToolStripElement element = new RadToolStripElement();

            element.Size         = new Size(600, element.Size.Height);
            element.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            RadToolStripItem item = new RadToolStripItem();

            item.Size         = new Size(600, item.Size.Height);
            item.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            element.Items.Add(item);
            item.Items.Add(new RadButtonElement("one"));
            item.Items.Add(new RadDropDownButtonElement());
            item.Items.Add(new RadToolStripSeparatorItem());
            item.Items.Add(new RadToggleButtonElement());
            item.Items.Add(new RadRepeatButtonElement());
            item.Items.Add(new RadImageButtonElement());
            item.Items.Add(new RadRadioButtonElement());
            item.Items.Add(new RadCheckBoxElement());
            item.Items.Add(new RadTextBoxElement());
            item.Items.Add(new RadMaskedEditBoxElement());
            item.Items.Add(new RadSplitButtonElement());
            item.Items.Add(new RadApplicationMenuButtonElement());

            RadComboBoxElement combo = new RadComboBoxElement();

            combo.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            item.Items.Add(combo);

            RadTextBoxElement textBoxElement = new RadTextBoxElement();

            textBoxElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            item.Items.Add(textBoxElement);

            RadToolStrip toolStrip = new RadToolStrip();

            toolStrip.BeginInit();
            toolStrip.AutoSize = false;

            toolStrip.Bounds = new Rectangle(30, 30, 400, 50);
            toolStrip.Items.Add(element);
            toolStrip.AllowFloating = false;
            toolStrip.AllowDragging = false;
            toolStrip.EndInit();

            RadToolStrip toolStripStructure = new RadToolStrip();

            toolStripStructure.BeginInit();
            toolStripStructure.AllowDragging = false;
            toolStripStructure.AllowFloating = false;
            toolStripStructure.AutoSize      = false;

            RadToolStripElement structureElement = new RadToolStripElement();

            structureElement.Size         = new Size(600, structureElement.Size.Height);
            structureElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            RadToolStripItem structureItem = new RadToolStripItem();

            structureItem.Size         = new Size(600, structureItem.Size.Height);
            structureItem.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;

            structureElement.Items.Add(structureItem);
            structureItem.Items.Add(new RadButtonElement("one"));
            structureItem.Items.Add(new RadDropDownButtonElement());
            structureItem.Items.Add(new RadToolStripSeparatorItem());
            structureItem.Items.Add(new RadToggleButtonElement());
            structureItem.Items.Add(new RadRepeatButtonElement());
            structureItem.Items.Add(new RadImageButtonElement());
            structureItem.Items.Add(new RadRadioButtonElement());
            structureItem.Items.Add(new RadCheckBoxElement());
            structureItem.Items.Add(new RadTextBoxElement());
            structureItem.Items.Add(new RadMaskedEditBoxElement());
            structureItem.Items.Add(new RadSplitButtonElement());
            structureItem.Items.Add(new RadApplicationMenuButtonElement());
            combo = new RadComboBoxElement();
            combo.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            structureItem.Items.Add(combo);

            textBoxElement = new RadTextBoxElement();
            textBoxElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;
            structureItem.Items.Add(textBoxElement);

            toolStripStructure.Bounds = new Rectangle(30, 30, 450, 50);

            toolStripStructure.Items.Add(structureElement);

            toolStripStructure.EndInit();

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(toolStrip, toolStripStructure.RootElement);

            designed.MainElementClassName = typeof(RadToolStripElement).FullName;
            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            res.Add(designed);

            return(res);
        }