protected override void OnThemeChanged() { base.OnThemeChanged(); if (!TelerikHelper.IsMaterialTheme(this.ThemeName)) { return; } SizeF dpiScaleFactor = this.PanelElement.DpiScaleFactor; this.ItemDefaultSize = new Size(Math.Max(this.ItemDefaultSize.Width, (int)(300.0 / (double)dpiScaleFactor.Width)), Math.Max(this.ItemDefaultSize.Height, (int)(36.0 / (double)dpiScaleFactor.Height))); this.DataEntryElement.Clear(); this.DataEntryElement.InitializeDataEntry(); this.DataEntryElement.CreateEditors(); this.DataEntryElement.ArrangeControls(); foreach (Control control1 in (ArrangedElementCollection)this.PanelContainer.Controls) { RadPanel radPanel = control1 as RadPanel; if (radPanel != null) { RadTextBox control2 = radPanel.Controls[0] as RadTextBox; if (control2 != null) { control2.TextBoxItem.StretchVertically = true; } } } }
protected virtual void InitializeEditor(IInputEditor activeEditor) { GridCellElement currentCell = this.gridViewElement.CurrentView.CurrentCell; if (currentCell == null) { return; } ISupportInitialize supportInitialize = activeEditor as ISupportInitialize; supportInitialize?.BeginInit(); EventDispatcher eventDispatcher = this.GridViewElement.Template.EventDispatcher; eventDispatcher.SuspendEvent(EventDispatcher.ValueChanging); eventDispatcher.SuspendEvent(EventDispatcher.ValueChanged); currentCell.ColumnInfo.InitializeEditor(activeEditor); activeEditor.Initialize((object)currentCell, currentCell.Value); eventDispatcher.ResumeEvent(EventDispatcher.ValueChanging); eventDispatcher.ResumeEvent(EventDispatcher.ValueChanged); GridViewCellEventArgs args = new GridViewCellEventArgs(currentCell.RowInfo, currentCell.ColumnInfo, activeEditor); this.gridViewElement.Template.EventDispatcher.RaiseEvent <GridViewCellEventArgs>(EventDispatcher.CellEditorInitialized, (object)this, args); if (TelerikHelper.IsMaterialTheme(this.gridViewElement.GridControl.ThemeName)) { BaseInputEditor activeEditor1 = args.ActiveEditor as BaseInputEditor; if (activeEditor1 != null) { activeEditor1.EditorElement.StretchVertically = true; } } supportInitialize?.EndInit(); }
private void radCheckedListBox1_VisualItemFormatting(object sender, ListViewVisualItemEventArgs e) { SimpleListViewVisualItem item = e.VisualItem as SimpleListViewVisualItem; Product product = item.Data.Tag as Product; string color = "#681406"; if (TelerikHelper.IsDarkTheme(this.radListView1.ThemeName)) { color = "#FFFFFF"; } if (item.Children.Count > 0) { ListViewItemCheckbox checkBoxItem = item.Children[0] as ListViewItemCheckbox; checkBoxItem.Margin = new Padding(2, 2, 3, 2); } item.Data.Text = "" + " " + product.Name + "" + " " + product.Weight + "gr" + " " + " " + string.Format("{0:C2}", product.Price) + ""; // item.ImageLayout = ImageLayout.Center; // item.ImageAlignment = ContentAlignment.MiddleLeft; }
public virtual void Synchronize() { if (this.Data == null || this.DataItem == null) { return; } object obj = this.DataItem[this.Data]; if ((object)this.Data.DataType == (object)typeof(DateTime)) { DateTime dateTime = !(obj is DateTime) ? Convert.ToDateTime(obj) : (DateTime)obj; this.Text = string.Format(this.Data.FormatString ?? "{0}", (object)dateTime); } else if (TelerikHelper.IsNumericType(this.Data.DataType)) { Decimal num = Convert.ToDecimal(obj); this.Text = string.Format(this.Data.FormatString ?? "{0}", (object)num); } else { this.Text = string.Format(this.Data.FormatString ?? "{0}", obj); } int num1 = (int)this.SetValue(GanttViewTextViewCellElement.CurrentColumnProperty, (object)this.column.Current); this.Owner.TextView.GanttViewElement.OnTextViewCellFormatting(new GanttViewTextViewCellFormattingEventArgs(this.Owner.Data, this, this.Data)); this.UpdateInfo(); }
//TODO: Check whether everything is working //protected override void OnFontChanged(EventArgs e) //{ // base.OnFontChanged(e); // this.ToggleHTML(this.Text); //} protected override void OnPropertyChanged(RadPropertyChangedEventArgs e) { if (e.Property == TextPrimitive.TextProperty) { this.textWithoutMnemonics = TelerikHelper.TextWithoutMnemonics((string)e.NewValue); this.ToggleHTML(this.textWithoutMnemonics); } else if (e.Property == AlignmentProperty || e.Property == FontProperty || e.Property == ForeColorProperty) { this.ToggleHTML(this.textWithoutMnemonics); } else if (e.Property == RadElement.AutoSizeModeProperty) { RadAutoSizeMode newAutoSizeMode = (RadAutoSizeMode)e.NewValue; if (newAutoSizeMode == RadAutoSizeMode.WrapAroundChildren) { this.TextAlignment = ContentAlignment.MiddleLeft; } else if (newAutoSizeMode == RadAutoSizeMode.FitToAvailableSize) { this.TextAlignment = ContentAlignment.TopLeft; } } base.OnPropertyChanged(e); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.ThemeName == "TelerikMetroTouch" || ThemeResolutionService.ApplicationThemeName == "TelerikMetroTouch") { this.context.CorrectPositions(); this.stripItemsListControl.Width -= 30; this.moveUpButton.Left -= 20; this.moveUpButton.Width += 20; this.moveDownButton.Left -= 20; this.moveDownButton.Width += 20; this.Width += 50; this.radPageView.Width += 50; } if (!TelerikHelper.IsMaterialTheme(this.ThemeName)) { return; } this.context.CorrectPositions(); this.stripItemsListControl.Width -= 30; this.moveUpButton.Left -= 25; this.moveUpButton.Width += 25; this.moveDownButton.Left -= 25; this.moveDownButton.Width += 25; this.closeButton.Width += 5; }
public override void BeginEdit() { base.BeginEdit(); RadTextBoxEditorElement editorElement = (RadTextBoxEditorElement)this.EditorElement; RadTextBoxItem textBoxItem = editorElement.TextBoxItem; if (!VirtualGridTextBoxEditor.IsDarkTheme(this.OwnerElement)) { int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White); } RadControl radControl = this.EditorElement.ElementTree == null || this.EditorElement.ElementTree.Control == null ? (RadControl)null : this.EditorElement.ElementTree.Control as RadControl; if (radControl != null && TelerikHelper.IsMaterialTheme(radControl.ThemeName)) { textBoxItem.StretchVertically = true; if (this.EditorElement.Parent != null) { this.EditorElement.Parent.UpdateLayout(); } } else { textBoxItem.StretchVertically = textBoxItem.Multiline; } textBoxItem.SelectAll(); textBoxItem.TextBoxControl.Focus(); textBoxItem.TextChanging += new TextChangingEventHandler(this.TextBoxItem_TextChanging); textBoxItem.TextChanged += new EventHandler(this.TextBoxItem_TextChanged); textBoxItem.KeyDown += new KeyEventHandler(this.TextBoxItem_KeyDown); textBoxItem.KeyUp += new KeyEventHandler(this.TextBoxItem_KeyUp); textBoxItem.MouseWheel += new MouseEventHandler(this.TextBoxItem_MouseWheel); }
internal void ShowWindow() { Debug.Assert(this.dockManager != null, "Null RadDock reference."); if (this.dockManager == null) { return; } //ensure proper AutoHideButton state RadToggleButtonElement autoHideButton = this.ToolStrip.AutoHideButton; if (autoHideButton != null) { autoHideButton.ToggleState = ToggleState.Off; } bool animate = this.dockManager.AutoHideAnimation == AutoHideAnimateMode.AnimateShow || this.dockManager.AutoHideAnimation == AutoHideAnimateMode.Both; if (animate) { int animationFlags = (int)this.GetAnimationFlags(this.AutoHideDock, AnimationType.Slide, true); TelerikHelper.AnimateWindow(this.Handle, this.animationDuration, animationFlags); base.Show(); } else { NativeMethods.ShowWindow(Handle, NativeMethods.SW_SHOWNOACTIVATE); } }
public override object ConvertFrom( ITypeDescriptorContext context, CultureInfo culture, object value) { return((object)TelerikHelper.ImageFromString((string)value)); }
protected override bool PerformPaintTransformation(ref RadMatrix matrix) { bool flag = false; float angleTransform = this.AngleTransform; if ((double)angleTransform != 0.0) { flag = true; RectangleF bounds = new RectangleF(PointF.Empty, (SizeF)this.Bounds.Size); TelerikHelper.PerformCenteredRotation(ref matrix, bounds, angleTransform); } SizeF scaleTransform = this.ScaleTransform; if ((double)scaleTransform.Width > 0.0 && (double)scaleTransform.Height > 0.0 && ((double)scaleTransform.Width != 1.0 || (double)scaleTransform.Height != 1.0)) { flag = true; matrix.Scale(scaleTransform.Width, scaleTransform.Height, MatrixOrder.Append); } SizeF positionOffset = this.PositionOffset; if (positionOffset != SizeF.Empty) { flag = true; matrix.Translate(this.RightToLeft ? -positionOffset.Width : positionOffset.Width, positionOffset.Height, MatrixOrder.Append); } return(flag); }
protected override Point ScrollToControl(Control activeControl) { Point point = Point.Empty; if (this.AllowAutomaticScrollToControl) { point = base.ScrollToControl(activeControl); } else { point = new Point(-this.parentPanel.HorizontalScrollbar.Value, -this.parentPanel.VerticalScrollbar.Value); if (!TelerikHelper.ControlIsReallyVisible(activeControl)) { point = base.ScrollToControl(activeControl); } } if (this.ScrollBarSynchronizationNeeded != null) { this.ScrollBarSynchronizationNeeded((object)this, new ScrollbarSynchronizationNeededEventArgs() { ActiveControl = activeControl, ScrolledLocation = point }); } return(point); }
protected override void OnThemeChanged() { base.OnThemeChanged(); this.timePickerDoneButtonElement.BackColor = this.timePickerDoneButtonElement.Owner.HoursTable.BackColor; this.timePickerDoneButtonElement.GradientStyle = GradientStyles.Solid; this.timePickerDoneButtonElement.DrawFill = true; this.timePickerDoneButtonElement.ButtonElement.Margin = new Padding(0); this.timePickerDoneButtonElement.ButtonElement.Padding = new Padding(0); if (this.timePickerDoneButtonElement.BorderBoxStyle == BorderBoxStyle.FourBorders) { this.timePickerDoneButtonElement.BorderLeftWidth = this.timePickerDoneButtonElement.BorderTopWidth; this.timePickerDoneButtonElement.BorderRightWidth = this.timePickerDoneButtonElement.BorderTopWidth; this.timePickerDoneButtonElement.BorderLeftColor = this.timePickerDoneButtonElement.BorderTopColor; this.timePickerDoneButtonElement.BorderRightColor = this.timePickerDoneButtonElement.BorderTopColor; this.timePickerDoneButtonElement.BorderBottomWidth = 0.0f; if (!TelerikHelper.IsMaterialTheme(this.ThemeName)) { return; } this.timePickerDoneButtonElement.BorderLeftWidth = 1f; this.timePickerDoneButtonElement.BorderLeftColor = Color.FromArgb(236, 236, 236); } else { this.timePickerDoneButtonElement.BorderBoxStyle = BorderBoxStyle.FourBorders; this.timePickerDoneButtonElement.BorderBottomWidth = 0.0f; } }
protected virtual void SubmitUserMessage() { string text = this.inputTextBox.Text; if (TelerikHelper.StringIsNullOrWhiteSpace(text)) { return; } this.inputTextBox.Text = string.Empty; ChatTextMessage chatTextMessage = new ChatTextMessage(text, this.Author, DateTime.Now); if (this.AutoAddUserMessages) { if (this.Author == null) { throw new ArgumentNullException("Author", "The Author property has to be set to a valid instance when AutoAddUserMessages is set to true."); } this.AddMessage((ChatMessage)chatTextMessage); } if (this.IsPopupOverlayShown) { this.HideOverlay(); } this.OnSendMessage(new SendMessageEventArgs((ChatMessage)chatTextMessage)); }
public virtual void ShowTypingIndicator(params Author[] authors) { this.typingIndicator.Visibility = ElementVisibility.Visible; if (authors == null || authors.Length == 0) { this.typingIndicator.Image = !TelerikHelper.IsDarkTheme(this.ElementTree.ThemeName) ? (Image)Telerik\u002EWinControls\u002EUI\u002EResources.typing_indicator_light : (Image)Telerik\u002EWinControls\u002EUI\u002EResources.typing_indicator_dark; Application.DoEvents(); } else { this.typingIndicator.Image = (Image)null; StringBuilder stringBuilder = new StringBuilder(); if (authors.Length == 1) { stringBuilder.Append(authors[0].Name).Append(" is typing..."); } else { stringBuilder.Append(authors[0].Name); for (int index = 1; index < authors.Length - 1; ++index) { stringBuilder.Append(", ").Append(authors[index].Name); } stringBuilder.Append(" and ").Append(authors[authors.Length - 1].Name).Append(" are typing..."); } this.typingIndicator.Text = stringBuilder.ToString(); } }
private void SetValue(object value) { bool flag = value != null && !TelerikHelper.StringIsNullOrWhiteSpace(value.ToString()) && Convert.ToBoolean(value); DataFilterCheckboxEditorElement editorElement = this.EditorElement as DataFilterCheckboxEditorElement; if (this.IsInitalizing) { editorElement.CheckState = flag ? Telerik.WinControls.Enumerations.ToggleState.On : Telerik.WinControls.Enumerations.ToggleState.Off; } else { object newValue = (object)flag; object oldValue = (object)null; switch (editorElement.CheckState) { case Telerik.WinControls.Enumerations.ToggleState.Off: case Telerik.WinControls.Enumerations.ToggleState.Indeterminate: oldValue = (object)false; break; case Telerik.WinControls.Enumerations.ToggleState.On: oldValue = (object)true; break; } ValueChangingEventArgs e = new ValueChangingEventArgs(newValue, oldValue); this.OnValueChanging(e); if (e.Cancel) { return; } editorElement.CheckState = flag ? Telerik.WinControls.Enumerations.ToggleState.On : Telerik.WinControls.Enumerations.ToggleState.Off; this.OnValueChanged(); } }
public override void SetTheme(string themeName) { this.ThemeName = themeName; foreach (RadItem radItem in (RadItemCollection)this.Items) { if (radItem is FilterMenuCalendarItem) { ((FilterMenuCalendarItem)radItem).CalendarElement.Calendar.ThemeName = themeName; } } if (this.ThemeName == "TelerikMetroTouch" || ThemeResolutionService.ApplicationThemeName == "TelerikMetroTouch") { this.Width = 350; this.Height = 550; this.buttonsMenuItem.Margin = new Padding(0, 0, 20, 0); this.calendarItem.MinSize = new Size(300, 300); } else if (TelerikHelper.IsMaterialTheme(this.ThemeName)) { Padding margin = this.buttonsMenuItem.Margin; margin.Right = 13; this.buttonsMenuItem.Margin = margin; this.Size = new Size(260, 510); } else { if (!this.ThemeName.StartsWith("Fluent") && (string.IsNullOrEmpty(ThemeResolutionService.ApplicationThemeName) || !ThemeResolutionService.ApplicationThemeName.StartsWith("Fluent"))) { return; } Padding margin = this.buttonsMenuItem.Margin; margin.Right = 10; this.buttonsMenuItem.Margin = margin; } }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { Image img = (Image)value; string res = TelerikHelper.ImageToString(img); return(res); }
public override void BeginEdit() { base.BeginEdit(); RadTextBoxControlElement textBox = this.TextBox; RadControl radControl = this.EditorElement.ElementTree == null || this.EditorElement.ElementTree.Control == null ? (RadControl)null : this.EditorElement.ElementTree.Control as RadControl; if (radControl != null && TelerikHelper.IsMaterialTheme(radControl.ThemeName)) { textBox.StretchVertically = true; if (this.EditorElement.Parent != null) { this.EditorElement.Parent.UpdateLayout(); } } else { textBox.StretchVertically = this.TextBox.Multiline; } textBox.SelectAll(); textBox.Focus(); textBox.TextChanging += new TextChangingEventHandler(this.OnTextChanging); textBox.TextChanged += new EventHandler(this.OnTextChanged); textBox.MouseWheel += new MouseEventHandler(this.OnElementMouseWheel); textBox.KeyDown += new KeyEventHandler(this.OnElementKeyDown); textBox.KeyUp += new KeyEventHandler(this.OnElementKeyUp); textBox.Navigator.SelectionChanging += new SelectionChangingEventHandler(this.Navigator_SelectionChanging); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string strValue = (string)value; Image res = TelerikHelper.ImageFromString(strValue); return(res); }
protected virtual void OnSendButtonElementClick(object sender, EventArgs e) { if (TelerikHelper.StringIsNullOrWhiteSpace(this.InputTextBox.Text)) { return; } this.SubmitUserMessage(); }
public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { return((object)TelerikHelper.ImageToString((Image)value)); }
protected override bool ProcessMnemonic(char charCode) { if ((this.UseMnemonic && TelerikHelper.CanProcessMnemonic(this)) && Control.IsMnemonic(charCode, this.Text)) { this.PerformClick(); return(true); } return(false); }
protected override bool ProcessMnemonic(char charCode) { if (!TelerikHelper.CanProcessMnemonic((Control)this) || (Control.ModifierKeys & Keys.Alt) != Keys.Alt || !Control.IsMnemonic(charCode, this.Text)) { return(false); } this.ShowDropDown(); return(true); }
protected override bool ProcessMnemonic(char charCode) { if (!this.UseMnemonic || !TelerikHelper.CanProcessMnemonic((Control)this) || ((Control.ModifierKeys & Keys.Alt) != Keys.Alt || !Control.IsMnemonic(charCode, this.Text))) { return(false); } this.PerformClick(); return(true); }
internal static bool IsDarkTheme(RadElement ownerElement) { string themeName = string.Empty; if (ownerElement != null && ownerElement.ElementTree != null) { themeName = ownerElement.ElementTree.ThemeName; } return(TelerikHelper.IsDarkTheme(themeName)); }
public override void PaintPrimitive(IGraphics graphics, float angle, SizeF scale) { TextParams textParams = this.CreateTextParams(); if (!this.UseCompatibleTextRendering && !this.Enabled && textParams.backColor == Color.Empty) { textParams.backColor = TelerikHelper.GetColorAtPoint(this.PointToScreen(Point.Round(textParams.paintingRectangle.Location))); } this.textPrimitiveImpl.PaintPrimitive(graphics, angle, scale, textParams); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!TelerikHelper.IsMaterialTheme(this.ThemeName)) { return; } this.dropDownZoom.MinSize = new Size(110, 0); this.radCommandBar.MinimumSize = new Size(0, 65); }
public void Add(object value) { string str = this.conversionInfoProvider == null ? (!string.IsNullOrEmpty(this.formatString) ? string.Format(this.formatString, value) : Convert.ToString(value, (IFormatProvider)CultureInfo.CurrentCulture)) : RadDataConverter.Instance.Format(value, typeof(string), this.conversionInfoProvider) as string; GridViewDataColumn conversionInfoProvider = this.DataConversionInfoProvider as GridViewDataColumn; if (TelerikHelper.StringIsNullOrWhiteSpace(str) || conversionInfoProvider != null && str.Equals(conversionInfoProvider.NullValue)) { str = string.Empty; } this.Add(str, value); }
private RadItem GetBottomMostItem() { foreach (RadItem item in this.tabStripElement.Items) { if (TelerikHelper.IsBottomAligned(item.Alignment)) { return(item); } } return((RadItem)this.tabStripElement.Items[this.tabStripElement.Items.Count - 1]); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (TelerikHelper.IsMaterialTheme(this.ThemeName)) { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(438, 377), this.RootElement.DpiScaleFactor); } else { this.ClientSize = TelerikDpiHelper.ScaleSize(new Size(292, 251), this.RootElement.DpiScaleFactor); } }