Telerik Forums
UI for WinForms Forum
4 answers
94 views
Hi
I am working in bilingual form
      when i call a form as Showdialog then it cant be change as culture .
      Like when i want to see English in English culture and Arabic in Arabic culture.
meraj
Top achievements
Rank 1
 answered on 05 Mar 2011
7 answers
627 views
Hi There.  I'm trying to dynamically disable/enable buttons in the grid but every command is becoming disabled...  
any ideas?

Thanks.
 


private
void gvMainInfo_CellFormatting(object sender, CellFormattingEventArgs e)
 {
            if (e.CellElement.Value != null)
            {
                if ((e.CellElement.ColumnInfo).HeaderText == "Status")
                {
                    GridCommandCellElement commandCell = (GridCommandCellElement)e.CellElement;
                    RadButtonElement buttonElement = (RadButtonElement)commandCell.Children[0];
 
 
                    if (e.CellElement.Value.ToString() == "Acitvate")
                    {
                            buttonElement.Enabled = true;
                     }
                    else
                    {
                        buttonElement.Enabled = false;
                    }
    }
}
Paul R.
Top achievements
Rank 1
 answered on 04 Mar 2011
11 answers
191 views
hey
1- i use dock control but autohideposition dont support "right top"
2-how to i  can select a icon for dock
Ivan Todorov
Telerik team
 answered on 04 Mar 2011
2 answers
201 views
Hello...
          I changed the theme of form and controls placed to "WinXPLuna" but they are not applying at runtime. Can u suggest me anything...

Thanks in advance...
Ivan Petrov
Telerik team
 answered on 04 Mar 2011
11 answers
504 views
Is there a way to focus the scroll position of the scheculer to the current time of the day.

For example if the day view is set for 24 hour format(0-23 hours) and the current time is 5pm, Is it possible to set the scroll position of the scheduler to 1700 hrs than 0hr. 
Peter
Telerik team
 answered on 04 Mar 2011
2 answers
62 views
Hi

I have added a mouse button handler to a RadTreeView in the TreeView's Loaded function like so:

            tv.AddHandler(RadTreeViewItem.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.radTreeView_MouseLeftButtonDown), true);

but when I set my project to use the 2011 Beta libs this event seems to be getting triggered twice for every click, but it is only triggered once in the previous libs.

Is this a new problem that has been introduced, or known / expected behaviour?

Thanks
Tim
Top achievements
Rank 1
 answered on 04 Mar 2011
3 answers
131 views
Hi, 

I have a function that calculates the color based on value in a cell.
This works nicely, but when i scroll, the cell color duplicates and attaches to cells that should not have the color.

Please look at the sample code:

namespace RadControlsWinFormsApp3
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.radGridView1 = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // radGridView1
            //
            this.radGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radGridView1.Location = new System.Drawing.Point(0, 0);
            this.radGridView1.Name = "radGridView1";
            this.radGridView1.Size = new System.Drawing.Size(364, 395);
            this.radGridView1.TabIndex = 0;
            this.radGridView1.Text = "radGridView1";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(364, 395);
            this.Controls.Add(this.radGridView1);
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView radGridView1;
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
 
namespace RadControlsWinFormsApp3
{
    public partial class Form1 : Form
    {
        List<RowHelper> rows = new List<RowHelper>();
        colorhelper MyColors = new colorhelper();
        public Form1()
        {
            InitializeComponent();
            Telerik.WinControls.UI.GridViewDecimalColumn gridViewDecimalColumn1 = new Telerik.WinControls.UI.GridViewDecimalColumn();
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn1 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            Telerik.WinControls.UI.GridViewComboBoxColumn gridViewComboBoxColumn1 = new Telerik.WinControls.UI.GridViewComboBoxColumn();
            Telerik.WinControls.UI.GridViewMultiComboBoxColumn gridViewComboBoxColumn2 = new Telerik.WinControls.UI.GridViewMultiComboBoxColumn();
 
 
 
            rows.Add(new RowHelper(1, "Row1", 1, 200000));
            rows.Add(new RowHelper(2, "Row2", 2, 400000));
            rows.Add(new RowHelper(3, "Row3", 3, 600000));
            rows.Add(new RowHelper(4, "Row4", 1, 1200000));
            rows.Add(new RowHelper(5, "Row4", 1, 1800000));
            rows.Add(new RowHelper(6, "Row4", 1, null));
            rows.Add(new RowHelper(7, "Row4", 1, null));
            rows.Add(new RowHelper(8, "Row4", 1, null));
            rows.Add(new RowHelper(9, "Row4", 1, null));
            rows.Add(new RowHelper(10, "Row4", 1, null));
            rows.Add(new RowHelper(11, "Row4", 1, null));
            rows.Add(new RowHelper(12, "Row4", 1, null));
            rows.Add(new RowHelper(13, "Row4", 1, null));
            rows.Add(new RowHelper(14, "Row4", 1, null));
            rows.Add(new RowHelper(15, "Row4", 1, null));
            rows.Add(new RowHelper(16, "Row4", 1, null));
            rows.Add(new RowHelper(17, "Row4", 1, null));
            rows.Add(new RowHelper(18, "Row4", 1, null));
            rows.Add(new RowHelper(19, "Row4", 1, null));
            rows.Add(new RowHelper(20, "Row4", 1, null));
            rows.Add(new RowHelper(21, "Row4", 1, null));
            rows.Add(new RowHelper(22, "Row4", 1, null));
            rows.Add(new RowHelper(23, "Row4", 1, null));
            rows.Add(new RowHelper(24, "Row4", 1, null));
            rows.Add(new RowHelper(25, "Row4", 1, null));
 
            List<helper> list = new List<helper>();
            list.Add(new helper(1, "test1"));
            list.Add(new helper(2, "test2"));
            list.Add(new helper(3, "test3"));
 
            List<multicolumnhelper> multicolumnlist = new List<multicolumnhelper>();
            multicolumnlist.Add(new multicolumnhelper(1, "test1", "col2"));
            multicolumnlist.Add(new multicolumnhelper(2, "test2", "col2"));
            multicolumnlist.Add(new multicolumnhelper(3, "test3", "col2"));
 
            gridViewComboBoxColumn1.DataSource = list;
            gridViewComboBoxColumn1.DisplayMember = "Value";
            gridViewComboBoxColumn1.ValueMember = "ID";
            gridViewComboBoxColumn1.HeaderText = "Test";
            gridViewComboBoxColumn1.Name = "test";
            gridViewComboBoxColumn1.FieldName = "RowID";
 
            gridViewTextBoxColumn1.Name = "rowtext";
            gridViewTextBoxColumn1.HeaderText = "rowtext";
            gridViewTextBoxColumn1.FieldName = "RowText";
 
 
            gridViewComboBoxColumn2.DataSource = multicolumnlist;
            gridViewComboBoxColumn2.DisplayMember = "Value";
            gridViewComboBoxColumn2.ValueMember = "ID";
            gridViewComboBoxColumn2.HeaderText = "Test";
            gridViewComboBoxColumn2.Name = "test2";
            gridViewComboBoxColumn2.FieldName = "RowID";
 
            gridViewDecimalColumn1.Name = "ColorTest";
            gridViewDecimalColumn1.HeaderText = "ColorTest";
            gridViewDecimalColumn1.FieldName = "ColorTest";
 
 
            radGridView1.Columns.AddRange(new Telerik.WinControls.UI.GridViewDataColumn[] { gridViewComboBoxColumn1, gridViewTextBoxColumn1, gridViewComboBoxColumn2, gridViewDecimalColumn1 });
            radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
            PopulateData();
 
            this.radGridView1.CellEditorInitialized += new GridViewCellEventHandler(radGridView1_CellEditorInitialized);
 
        }
 
        void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
        {
            if (e.Column.Name == "ColorTest")
            {
                if (e.CellElement.Value != null)
                {
                    e.CellElement.DrawFill = true;
                    try
                    {
 
                        Color useColor = MyColors.GetColorForValue((int)e.CellElement.Value);
                        e.CellElement.BackColor = useColor;
                        e.CellElement.BackColor2 = useColor;
                        e.CellElement.BackColor3 = useColor;
                        e.CellElement.BackColor4 = useColor;
                    }
                    catch (Exception)
                    {
 
                      
                    }
                }
            }
        }
 
        void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
        {
            if (e.ActiveEditor is RadMultiColumnComboBoxElement)
            {
                RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)e.ActiveEditor;
                editor.DropDownWidth = 200;
                editor.EditorControl.ShowColumnHeaders = false;
                editor.EditorControl.Columns["ID"].IsVisible = false;
                editor.EditorControl.ShowRowHeaderColumn = false;
            }
        }
 
        private void PopulateData()
        {
            radGridView1.DataSource = rows;
        }
 
         
    }
 
    public class colorhelper
    {
        public colors DefaultColor = null;
        List<colors> myColors = new List<colors>();
        public colorhelper()
        {
             
            myColors.Add(new colors(0, 300000, Color.Green, Color.Green));
            myColors.Add(new colors(300000, 500000, Color.Green, Color.Yellow));
            myColors.Add(new colors(500000, 1200000, Color.Yellow, Color.Red));
            DefaultColor = myColors[2];
        }
 
 
        public Color GetColorForValue(decimal Value)
        {
            colors col = myColors.Find(c => c.From <= Value && c.To >= Value);
            if (col == null) col = DefaultColor;
            return col.GetColor(Value);
        }
 
        public class colors{
 
            public colors(int from, int to, Color fromcolor, Color tocolor)
            {
                From = from;
                To = to;
                FromColor = fromcolor;
                ToColor = tocolor;
            }
 
            public int From { get; set; }
            public int To { get; set; }
            public Color FromColor { get; set; }
            public Color ToColor { get; set; }
 
            
            public int size
            {
                get { return To - From; }
            }
 
            public int relativeValue(decimal value)
            {
                if (value > To)
                    return 0;
                else
                    return To - (int)value;
            }
 
            public Color GetColor(decimal Value)
            {
                int rMax = FromColor.R;
                int rMin = ToColor.R;
                int gMax = FromColor.G;
                int gMin = ToColor.G;
                int bMax = FromColor.B;
                int bMin = ToColor.B;
 
                var rAverage = Math.Abs(rMin + (int)((rMax - rMin) * relativeValue(Value) / size));
                var gAverage = Math.Abs(gMin + (int)((gMax - gMin) * relativeValue(Value) / size));
                var bAverage = Math.Abs(bMin + (int)((bMax - bMin) * relativeValue(Value) / size));
 
                return Color.FromArgb(rAverage, gAverage, bAverage);
            }
        }
    }
 
    public class helper
    {
        public helper(int id, string value)
        {
            ID = id;
            Value = value;
        }
 
        public int ID { get; set; }
        public string Value { get; set; }
    }
 
    public class multicolumnhelper
    {
        public multicolumnhelper(int id, string value, string value2)
        {
            ID = id;
            Value = value;
            Value2 = value2;
        }
 
        public int ID { get; set; }
        public string Value { get; set; }
        public string Value2 { get; set; }
 
 
 
    }
    public class RowHelper
    {
        public RowHelper(int id, string text, int id2, int? value)
        {
            RowID = id;
            RowText = text;
            RowID2 = id2;
            ColorTest = value;
        }
 
        public int RowID { get; set; }
        public string RowText { get; set; }
        public int RowID2 { get; set; }
        public int? ColorTest { get; set; }
 
 
    }
 
}
Richard Slade
Top achievements
Rank 2
 answered on 04 Mar 2011
3 answers
138 views
Hi,
 2 questions...

1. Is there a way of keeping the column visible but not appearing in the export?
2. How and what do innerelements do?


Thanks
Deepak
Richard Slade
Top achievements
Rank 2
 answered on 04 Mar 2011
1 answer
167 views
Is there a way to make the textbox part of a dropdownlist readonly (so it works more like a html dropdown) ?
Richard Slade
Top achievements
Rank 2
 answered on 04 Mar 2011
1 answer
133 views
Hi All,
I'm working on customizing certain menu items available on Filter ContextMenu. For that I'm handling ContextMenuOpening event. 
This event is generated for all context menus like, Header context menu, Data row context menu and Filter row funnel-button context menu. I wanted to differentiate among these Context Menus and handle only Filter row funnel-button context menu.

Actually one thing I observed was on ContextMenuProvider. It varies like HeaderCellElement, DataCellElement and for funnel-button it is null. Is it a right object to differentiate the context menus or is there any other options available? Please help me out.

Thanks and Regards
ArunDhaJ
Richard Slade
Top achievements
Rank 2
 answered on 04 Mar 2011
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
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?