Telerik Forums
UI for WinForms Forum
1 answer
24 views

Hi,

When I "left click" on a header of a page, the page is changed before I release the mouse click.

Also, when right clicking it's selecting/unselecting a page, it looks strange.

Before I override many things, how would you do to change this behavior in a clean way? We won't deactivate right-click because we do have context menu to save the opening tab on new view show.

Thanks a lot in advance!

Simon

 

 

Nadya | Tech Support Engineer
Telerik team
 answered on 16 Jul 2024
1 answer
37 views

Hi everyone,

I'm currently working with the RadRichTextEditor control in my C# WinForms application, and I need to customize the colors of the slide and background bar. Could someone guide me on the steps to change these colors? Additionally, if there's a way to achieve this directly through code, I'd greatly appreciate it if you could share a code snippet.

Thank you in advance for your help!

Best regards,
Kevin

Nadya | Tech Support Engineer
Telerik team
 answered on 16 Jul 2024
1 answer
23 views

Hi,

I saw that in GridView you can create a group for the column header (https://docs.telerik.com/devtools/winforms/controls/gridview/view-definitions/column-groups-view).

Is it possible to have the same feature in VirtualGrid?

I need something similar in the attached image. Just a simple group description without additional filters.

Thank you very much.

 

Emanuele

Nadya | Tech Support Engineer
Telerik team
 answered on 12 Jul 2024
1 answer
37 views

I have a data entry RadGridView bound to a collection of POCOs. It has some rather compiles editing requirements. On one particular row, there is a cell that requires the edit control to be a multi-selection combo box. On all other rows it requires a numeric entry. I created the column as a GridViewComboBoxColumn. and then tried to create a custom control to replace the standard editor using the EditorRequired event like this:

        private void gvMatrix_EditorRequired(object sender, EditorRequiredEventArgs e)

        {
            if (gvMatrix.CurrentRow.Cells["Comparison"].Value.ToString() == "One of")
            {
                if (e.EditorType == typeof(CustomCheckedListBox))
                    e.EditorType = typeof(CustomCheckedListBox);
            }

//Otherwise I need numeric entry

        }

 

Then, I tried to create the custom control based on the example on the Telerik site (https://docs.telerik.com/devtools/winforms/controls/gridview/editors/using-custom-editors) and came up with this:

 public class CustomCheckedListBox : BaseGridEditor
 {
     protected override RadElement CreateEditorElement()
     {
         return new CustomCheckedListBoxElement();
     }

     public override object Value
     {
         get
         {
             CustomCheckedListBoxElement element = this.EditorElement as CustomCheckedListBoxElement;
             return element.CheckedDropDownElement.Value;
         }
         set
         {
             CustomCheckedListBoxElement element = this.EditorElement as CustomCheckedListBoxElement;
             element.CheckedDropDownElement.Value = value;
         }
     }

     public override void BeginEdit()
     {
         base.BeginEdit();

         CustomCheckedListBoxElement element = this.EditorElement as CustomCheckedListBoxElement;

         var statesData = new List<Dictionary>();

         statesData.Add(new Dictionary { DictionaryKeyString = "AK", Description = "Alaska" });
         statesData.Add(new Dictionary { DictionaryKeyString = "NJ", Description = "New Jersey" });
         statesData.Add(new Dictionary { DictionaryKeyString = "AL", Description = "Alabama" });
         statesData.Add(new Dictionary { DictionaryKeyString = "GA", Description = "Georgia" });

         element.DataSource = statesData;
         element.DropDownStyle = RadDropDownStyle.DropDownList;
         element.ValueMember = "DictionaryKeyString";
         element.DisplayMember = "Description";
     }

     public override bool EndEdit()
     {
         return base.EndEdit();
     }

     //public string? ValueMember { get; set; }
     //public string? DisplayMember { get; set; }
     //public object? DataSource { get; set; }
 }

 public class CustomCheckedListBoxElement : RadCheckedDropDownListElement
 {
     RadCheckedDropDownListElement dropDownListElement = new RadCheckedDropDownListElement();

     public CustomCheckedListBoxElement()
     {
     }

     public RadCheckedDropDownListElement CheckedDropDownElement
     {
         get =>  this.dropDownListElement;           
     }

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

What I get is a an empty dropdown in the cell with no data appearing. Ideally I'd like to instantiate the custom control and pass in the DataSource, ValueMember, etc. so I can reuse it elsewhere. The goal is to retrieve a list of selected states and display them like this when the cell is not in edit mode:

Alabama

New Jersey

Georgia

Any ideas on how to accomplish this?

Thanks

Carl

Dinko | Tech Support Engineer
Telerik team
 answered on 10 Jul 2024
1 answer
45 views

Hello,

is it possible to end edit when user navigates to other cell? The same behavior as standard DataGridView:

I tried to call EndEdit in CurrentCellChanged event handler, but it doesn't work, probably there is something with current cell changing, nor IsInEditMode is not set in this event.

Nadya | Tech Support Engineer
Telerik team
 answered on 10 Jul 2024
1 answer
30 views

Hello,

I would like to help with GridViewComboBoxColumn behavior. I have almost solved how to automatically show popup on click. Next, I want to end edit after selecting some item from combo box, similar to standard DataGridView behavior. I have done this so far:

private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
	// automatic combo expanding
	if (radGridView1.IsInEditMode)
		return;

	var cell = sender as GridComboBoxCellElement;
	if (cell == null)
		return;

	radGridView1.BeginEdit();
	var editor = cell.Editor as RadDropDownListEditor;
	if (editor == null)
		return;

	var el = editor.EditorElement as RadDropDownListEditorElement;
	if (el == null)
		return;

	el.SelectedIndexChanged += El_SelectedIndexChanged;

	el.ShowPopup();
}

private void El_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
	var el = sender as RadDropDownListEditorElement;
	if(el == null) 
		return;

	radGridView1.EndEdit();
	el.SelectedIndexChanged -= El_SelectedIndexChanged;
}

I attach SelectedIndexChanged event handler to RadDropDownListEditorElement before showing popup. In this handler, I call EndEdit first and then detach the handler. This works ok except for one case, when user selects the same item, in this case SelectedIndexChanged is not fired, because SelectedIndex hasn't changed:

I tried the same with other events like PopupClosed, but when I cal EndEdit in these events, selected value is not commited. Is it possible to do this somehow? I have attached test project, TelerikTestReal in solution. Thanks.

Nadya | Tech Support Engineer
Telerik team
 answered on 09 Jul 2024
1 answer
20 views

Hello,

I would like to ask about DataError event once more (we discussed it a little in some previous thread). I have tested behavior and program crashes in case of parsing error. First, if I do some validation in underlying data object and throw exception in object property setter, GridView handles it corectly and fires DataError event. But in case of parsing error, for example when I have textbox column, integer property and enter some non-numeric text, program crashes with unhandled exception:

I know, I should use GridViewDecimalColumn, but generally, why GridView doesn't handle parsing error and doesn't fire DataError event also in this case? I have attached also the test project, TelerikTestDataError in solution.

Unhandled exception:
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.ComponentModel.BaseNumberConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
   at Telerik.WinControls.UI.RadDataConverter.ParseCore(Object value, Type targetType, Type sourceType, TypeConverter dataTypeConverter, IDataConversionInfoProvider dataColumn, Boolean checkFormattedNullValue, CultureInfo cultureInfo)
   at Telerik.WinControls.UI.RadDataConverter.Parse(IDataConversionInfoProvider converstionInfoProvider, Object value, CultureInfo cultureInfo)
   at Telerik.WinControls.UI.GridDataCellElement.set_Value(Object value)
   at Telerik.WinControls.UI.GridViewEditManager.EndEditCore(Boolean validate, Boolean cancel)
   at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
   at Telerik.WinControls.UI.GridRowBehavior.ProcessEnterKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.GridRowBehavior.ProcessKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridBehavior.ProcessKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridBehavior.ProcessKeyDown(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridEditor.OnKeyDown(KeyEventArgs keyEventArgs)
   at Telerik.WinControls.UI.RadTextBoxEditor.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadTextBoxEditor.TextBoxItem_KeyDown(Object sender, KeyEventArgs e)
   at System.Windows.Forms.KeyEventHandler.Invoke(Object sender, KeyEventArgs e)
   at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_KeyDown(Object sender, KeyEventArgs e)
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
   at System.Windows.Forms.TextBox.WndProc(Message& m)
   at Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Nadya | Tech Support Engineer
Telerik team
 answered on 09 Jul 2024
1 answer
16 views
Hi,
    I can add context menu when right click on the grid, but based on selected value from context menu, i want to hide / show the rows.
Ex: Grid have 4 column's,  One of the column name is "Status", in that we get "Export" , "Done" and "Pending" for each rows, so i show there 3 values in context menu when right click on the grid using following code


'Declaration Private contextMenu1 As RadContextMenu 'Page Load contextMenu1 = New RadContextMenu() Dim menuItem1 As New RadMenuItem("Export") menuItem1.ForeColor = Color.Red AddHandler menuItem1.Click, AddressOf rmi1_Click Dim menuItem2 As New RadMenuItem("Verification") AddHandler menuItem2.Click, AddressOf rmi2_Click contextMenu1.Items.Add(menuItem1) contextMenu1.Items.Add(menuItem2) 'Code for show context menu Private Sub RadGridView1_ContextMenuOpening(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.ContextMenuOpeningEventArgs) Handles RadGridView1.ContextMenuOpening e.ContextMenu = contextMenu1.DropDown End Sub 'Menu click event Private Sub rmi2_Click(sender As Object, e As EventArgs) sender.Visible = CDec(sender.Row.Cells("Status").Value) = "Export" End Sub Private Sub rmi1_Click(sender As Object, e As EventArgs) sender.Visible = CDec(sender.Row.Cells("Status").Value) = "Done" End Sub

 Private Sub rmi1_Click(sender As Object, e As EventArgs)
        sender.Visible = CDec(sender.Row.Cells("Status").Value) = "Pending"
 End Sub

Thanks and Regards
Aravind
Dinko | Tech Support Engineer
Telerik team
 answered on 08 Jul 2024
2 answers
31 views

I have created a custom PropertyGridItemElement for my RadPropertyGrid to hold a button.  When the user clicks the button, the click handler performs some action, but the action is based on data that is known by the form that contains the propertygrid that contains the custom element.  How do I arrange for that data to be available to the button's Click handler?  The constructor of the custom element isn't even called explicitly -- it's implicit in 

PropertyGrid.CreateItemElement += (sender, args) =>
{
if (args.Item.Name == nameof(LabelWrapper.Button))
{
args.ItemElementType = typeof(CustomPropertyGridItemElement);
}
};

Thanks in advance.

Michael
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 04 Jul 2024
14 answers
439 views
I have a RadPageView (DetailTabControl).  I want to change the strip item's back color to red under some condition.  Then I might need to change it back.  I figured out how to change it to red.  Restoring the prior values does not restore the tab as I expected.  The back color (which I caught before setting to Red, ARGB(255, 191, 219, 255)) is for that of the PageView, not the PageViewPage.  Please see attached images.

public class Globals
{
public static Color DefaultTabColor = Color.FromArgb(255, 191, 219, 255);
}
...
private void CancelTab(int offset)
{
     DetailTabControl.Pages[offset].Item.DrawFill = true;
     DetailTabControl.Pages[offset].Item.NumberOfColors = 1;
     DetailTabControl.Pages[offset].Item.BackColor = Color.Red;   
}
private void UncancelTab(int offset)
{
     DetailTabControl.Pages[offset].Item.BackColor = Globals.DefaultTabColor;
     DetailTabControl.Pages[offset].Item.NumberOfColors = 2;
     DetailTabControl.Pages[offset].Item.DrawFill = false;
}

Álvaro
Top achievements
Rank 1
Iron
Iron
 answered on 02 Jul 2024
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ComboBox and ListBox (obsolete as of Q2 2010)
ListView
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
Menu
PropertyGrid
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
Rotator
TrackBar
MessageBox
SpinEditor
StatusStrip
CheckedListBox
Wizard
ShapedForm
SyntaxEditor
TextBoxControl
LayoutControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
DataEntry
GroupBox
ScrollablePanel
WaitingBar
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Styling
Barcode
ColorBox
Callout
FilterView
PictureBox
VirtualKeyboard
NavigationView
Accessibility
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
Flyout
ToolbarForm
NotifyIcon
Rating
TimeSpanPicker
BarcodeView
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
+? more
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?