Telerik Forums
UI for WinForms Forum
2 answers
96 views
Hey all,

I'm trying to do a very simple carousel, with just 3 buttons, each with a 128px image and text underneath. The layout I'm trying to achieve (I keep getting close, but cannot get it right), is to have the main/active button to be front and center, with the 2 other buttons aligned evenly behind and to the side (respectively) of the main/active button. The 2 inactive buttons would ideally be slightly opaque to help the main/active button stand out.

I've attached a crude, but simple drawing of what the layout should look like (although I don't think the pic is perfectly aligned).

Any chance someone can help me with the carousel path settings? Maybe someone already has done this and can just provide the correct settings.

Thank you so much for any help you can provide!
Peter
Telerik team
 answered on 06 Jan 2012
1 answer
95 views
I have encountered a problem where I enabled a GridCommandCellElement in the ViewCellFormatting event handler. The cell/button is enabled but it appears disabled (grayed out). The cell/button only appears enabled (not grayed out) after the focus is shifted to the row that contains the cell/button.

I have attached a sample project that I used to reproduce the issue. To reproduce this issue:

1. Delete the fourth row which has a Year  of '4'. This will enable the insert ('+') button for the third row.
2. You can click on the insert ('+') button for the third row even though it appears disabled and a new row will be inserted.
3. If you click in the row header for the third row, the insert ('+') button, will now appear enabled.

The issue is why does the cell/button appear to be disabled still after it has been enabled in the code.

Here is the cs file:

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.Primitives;
using Telerik.WinControls.UI;
 
namespace GridCellEnabled
{
    public partial class Form1 : Form
    {
        private GridViewTextBoxColumn _yearColumn = null;
        private GridViewTextBoxColumn _valueColumn = null;
        private GridViewCommandColumn _insertRowColumn = null;
        private GridViewCommandColumn _deleteRowColumn = null;
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            SetupGrid();
        }
 
        private void SetupGrid()
        {
            // Add Columns
            {
                // Year Column
                {
                    _yearColumn = new GridViewTextBoxColumn();
                    _yearColumn.Name = "Year";
                    _yearColumn.HeaderText = "Year";
 
                    _grid.Columns.Add(_yearColumn);
                }
 
                // Value Column
                {
                    _valueColumn = new GridViewTextBoxColumn();
                    _valueColumn.Name = "Value";
                    _valueColumn.HeaderText = "Value";
 
                    _grid.Columns.Add(_valueColumn);
                }
 
                // Insert Row Column
                {
                    _insertRowColumn = new GridViewCommandColumn();
                    _insertRowColumn.Name = "InsertRow";
                    _insertRowColumn.HeaderText = string.Empty;
                    _insertRowColumn.UseDefaultText = true;
                    _insertRowColumn.DefaultText = "+";
                    _insertRowColumn.MinWidth = 20;
                    _insertRowColumn.TextAlignment = ContentAlignment.MiddleCenter;
 
                    _grid.Columns.Add(_insertRowColumn);
                }
 
                // Delete Row Column
                {
                    _deleteRowColumn = new GridViewCommandColumn();
                    _deleteRowColumn.Name = "DeleteRow";
                    _deleteRowColumn.HeaderText = string.Empty;
                    _deleteRowColumn.UseDefaultText = true;
                    _deleteRowColumn.DefaultText = "-";
                    _deleteRowColumn.MinWidth = 20;
                    _deleteRowColumn.TextAlignment = ContentAlignment.MiddleCenter;
 
                    _grid.Columns.Add(_deleteRowColumn);
                }
            }
 
            // Add Rows
            {
                for (int i = 1; i <= 5; i++)
                {
                    GridViewRowInfo row = _grid.Rows.AddNew();
 
                    row.Cells[_yearColumn.Name].Value = i;
                    row.Cells[_valueColumn.Name].Value = i * 10;
                }
            }
 
            _grid.BestFitColumns();
        }
 
        private void _grid_CommandCellClick(object sender, EventArgs e)
        {
            GridViewCellEventArgs args = e as GridViewCellEventArgs;
 
            if (args.Column == _insertRowColumn)
            {
                InsertRow(args.RowIndex);
            }
            else if (args.Column == _deleteRowColumn)
            {
                DeleteRow(args.RowIndex);
            }
        }
 
        private void InsertRow(int aRow)
        {
            GridViewDataRowInfo rowInfo = new GridViewDataRowInfo(_grid.MasterView);
 
            int startYear = Convert.ToInt32(_grid.Rows[aRow].Cells["Year"].Value) + 1;
 
            rowInfo.Cells[_yearColumn.Name].Value = startYear;
            rowInfo.Cells[_valueColumn.Name].Value = startYear * 10;
 
            _grid.Rows.Insert(aRow + 1, rowInfo);
        }
 
        private void DeleteRow(int aRow)
        {
            _grid.Rows.RemoveAt(aRow);
        }
 
        private void _grid_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        {
            if (e.CellElement is GridCommandCellElement && e.RowIndex >= 0)
            {
                if (e.Column == _insertRowColumn)
                {
                    if (e.RowIndex + 1 < _grid.RowCount)
                    {
                        int startYear = Convert.ToInt32(_grid.Rows[e.RowIndex].Cells[_yearColumn.Name].Value);
                        int nextYear = Convert.ToInt32(_grid.Rows[e.RowIndex + 1].Cells[_yearColumn.Name].Value);
 
                        if ((startYear + 1) == nextYear)
                        {
                            e.CellElement.Enabled = false;
                        }
                        else
                        {
                            e.CellElement.Enabled = true;
                        }
                    }
                    else
                    {
                        e.CellElement.Enabled = true;
                    }
                }
                else if (e.Column == _deleteRowColumn)
                {
                    if (e.RowIndex == 0)
                    {
                        e.CellElement.Enabled = false;
                    }
                    else
                    {
                        e.CellElement.Enabled = true;
                    }
                }
            }
        }
    }
}

Here is the Designer.cs file:

namespace GridCellEnabled
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <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._grid = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this._grid)).BeginInit();
            this.SuspendLayout();
            //
            // _grid
            //
            this._grid.Location = new System.Drawing.Point(12, 12);
            this._grid.Name = "_grid";
            this._grid.Size = new System.Drawing.Size(260, 238);
            this._grid.TabIndex = 0;
            this._grid.ViewCellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler(this._grid_ViewCellFormatting);
            this._grid.CommandCellClick += new Telerik.WinControls.UI.CommandCellClickEventHandler(this._grid_CommandCellClick);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Controls.Add(this._grid);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(this._grid)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView _grid;
    }
}
Ivan Petrov
Telerik team
 answered on 06 Jan 2012
4 answers
256 views

VB.NET
.NET 3.5

RadControls for WinForms Q1 2009 SP1
MS Visual Studio 2008

I have been able to do just about everything else I need to do in the Treeview control, except capturing click events in my form. The tree is generated from SQL tables and otherwise appears fine. Ultimately I am hoping to wire the tree nodes to files in the filesystem.
Following is the code to capture the DoubleClick event (copied from documentation):

Private

 

Sub RadTreeView1_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

Dim args As MouseEventArgs = TryCast(e, MouseEventArgs)

 

 

 

Dim clickedNode As RadTreeNode = RadTreeView1.GetNodeAt(args.X, args.Y)

 

 

 

If clickedNode <> Nothing Then

 

 

 

 

    MessageBox.Show("Node Text: " + clickedNode.Text + " Node Value: " + clickedNode.Tag)

 

 

 

End If

 

 

 

 

End Sub

 

 

 

 

 

 

The only other block of code in my form is my form load which loads the tree with data from the database.

I have 2 questions/problems:
1. Visual Studio is complaining about the IF statement: "Operator '<>' is not defined for types 'Telerik.WinControls.UI.RadTreeNode' and 'Telerik.WinControls.UI.RadTreeNode'. What does this mean?
2. It appears the DoubleClick event isn't being captured since nothing happens when I double click a node. Is the IF statement error related to this? What am I missing? For my testing I simply commented out the 'If...' and 'End If' lines.

Thanks in advance for any guidance you can provide.
Matt

Stefan
Telerik team
 answered on 05 Jan 2012
9 answers
85 views
I'm trying to find an example of creating a custom grid filter popup.  Anybody have one yet?
Ivan Petrov
Telerik team
 answered on 04 Jan 2012
2 answers
236 views
Hello

I clearly understand how to use the event associated with a CommandColumn click event (GridView_CommandCellClick). What I would like to do is gain access to the button's properties (GridViewCommandColumn Button) from another method. For example, if i have this method: "private void ChangeButtonText(GridViewRowInfo rowIndex, String buttonText)". This method is not associated with the click event of a CommandButton but this method needs to access CommandButton's properties for the given rowIndex and change the CommandButton.Text property equal to buttonText.

I am using VS 2010, C# and Q2 update.

Any help would be appreciated.

Thank You
Ivan Petrov
Telerik team
 answered on 04 Jan 2012
1 answer
97 views
Hi,

There seems to be a small layout bug when I have invisible columns in my grid with a Column Groups view. Looks like the invisible columns are still taking up a few pixels, causing borders to not line up correctly between neighboring groups. If you have enough invisible columns, you can see double borders where one group ends and another group starts. Please view the attached screen grab to see what I'm talking about.
Jack
Telerik team
 answered on 04 Jan 2012
1 answer
62 views
Please update the cab enabling kit for 2011 Q3. most of the controls are not supported(tabstrip,toolstrip).
Change it for pageview,commandbar instead of tabstrip and toolbar.
Stefan
Telerik team
 answered on 03 Jan 2012
1 answer
126 views
Hi,
    Since I can't resolve the Enter key event of my Custom column with a TextBox and a Button, I decide to use the BrowserColumn of GridView of 2011Q3 now. I have a test project using the BrowserColumn in 2011Q3, I want to popup my own Form when I click the button of the BrowserColumn. How can I implement?
Ivan Petrov
Telerik team
 answered on 03 Jan 2012
9 answers
192 views
Hey all, 

I have a very simple radtreeview structure. I basically have 3 root nodes and each node has 3 children. Every time I expand the tree node, there's a delay loading the child nodes. The delay isn't huge but it's a very noticeable delay compared to the original TreeView control. I suspect this has to do with the way the node appears (the turn on looking way). Is there a way to change that behavior so it's identical to the Windows TreeView control ?

Thanks

Stefan
Telerik team
 answered on 02 Jan 2012
1 answer
574 views
I was looking through the forum for a solution on how to hide the customize options for each CommandBarStripElement as well as the main RadCommandBar. We don't want our users to be able to add or remove any buttons we have added. If there is a better way than cancelling the drop down event please let me know. Thank you.
Stefan
Telerik team
 answered on 30 Dec 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
ProgressBar
CheckedDropDownList
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
VirtualKeyboard
NavigationView
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?