Telerik Forums
UI for WinForms Forum
11 answers
491 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
55 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
128 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
134 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
160 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
127 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
2 answers
143 views
Hi,

This is a two part question.

1) I'm using the self-referencing feature of the GridView. When the child rows of a parent displayed, they are aligned with the parent. How do I indent the children so I can emphasize the hierarchical relationship?

2)It also seems that when the GridView is both self-referencing and grouped, each row has two expanding buttons (one redundant). How do I make the expanding button invisible on the row header? I want to only show the button nested inside the cell. 

Please see the attached screen shot.

Thanks for your help!
Josh
Svett
Telerik team
 answered on 04 Mar 2011
1 answer
111 views

Is it possible to change the appointment view color in win form according to our requirement?

 

I have several categories and I want each category to be displayed in different color.

 

 


In the attached picture you can see some appointments retrieved from the database.

Each one is from deferent category so I want to differentiate using a color for each appointment.

 


Thanks a lot in advance

Dobry Zranchev
Telerik team
 answered on 04 Mar 2011
3 answers
137 views
2 Questions:

1. How can a progress bar be implemented with any of the exporters?

2. When I use ExportToExcelML it always exports the file as a .xls instead of xml.  Nowhere in my code is xls mentioned and I explicitly state it should be an xml file... what gives?

Thanks!
ASG
Top achievements
Rank 1
 answered on 04 Mar 2011
1 answer
158 views
If there are no children in treeview node, then there must not by any plus sign. Why you show plus sign ? i dont understand. No children nodes cannot expand.

Thanks
Richard Slade
Top achievements
Rank 2
 answered on 03 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)
Chart (obsolete as of Q1 2013)
Form
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
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
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
NavigationView
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?