Hi~
Can I set task date format "yyyyMMdd"
don't use hhmmss
ganttview_ItemChanged(object sender, GanttViewItemChangedEventArgs e)
{
e.Start = new DateTime(e.Start.Year, e.Start.Month, e.Start.Day);
}
Hello,
This morning I updated a project I am currently working on that is using the Material theme to the newest Winforms controls release. Before when I would click on a button, the button would do a little "click" visual effect and then that was it. Now when I click on a button it plays that effect and then the button turns purple. Was this theme changed and how do I fix this? Having a button turn purple is extremely distracting and will most likely confuse the users of my programs.
Thanks,
Matt
Hello,
I am attempting to create a very simple Windows Explorer-like interface for a training program. This program consists of a treeview on the left, a listview on the right, and a breadcrumb along the top. When a user clicks on a node in the treeview, the listview is updated with a list of the folder's contents (files only). However, the breadcrumb I have attached to the treeview doesn't act at all as I expected. It appears to act like just a list of menus, whereas I want it to act like Windows File Explorer and be a button that takes the user to whatever folder is clicked, and then not show anything other than the total path to the folder selected on the treeview. I can't seem to find a setting that allows this.
How do I get the breadcrumb to act like Windows File Explorer?
Thanks,
Matt
Hi everyone
I put a RadGridView in Form with enabled its edit mode (AllowEditRow = true), and has "id" and "name" columns, and three rows of data. Also I created a custom user control that has a TextBox and a Button (named it ccTest). Then I choose a cell from "name" column and any row at run time. Now I start to type letters from keyboard. In this case, I bring up the custom user control.
The problem is: The typed letters don't show in custom user control, because it's TextBox not focused yet. Therefore I must click one more time to focus it, before start type letters.
Question is: How can I focus the TextBox of custom user control when it appear from CellBeginEdit event?
Microsoft Visual Studio 2017 (C# language) installed on Windows 10 - Telerik WinForms 2017 R3 SP1 (2017.3.1017.40).
-------------------------------------------
ccTest.Designer.cs:
namespace
TestGridFocus
{
partial
class
ccTest
{
/// <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 Component 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
.textBox1 =
new
System.Windows.Forms.TextBox();
this
.button1 =
new
System.Windows.Forms.Button();
this
.SuspendLayout();
//
// textBox1
//
this
.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this
.textBox1.Location =
new
System.Drawing.Point(0, 0);
this
.textBox1.Multiline =
true
;
this
.textBox1.Name =
"textBox1"
;
this
.textBox1.Size =
new
System.Drawing.Size(92, 20);
this
.textBox1.TabIndex = 0;
//
// button1
//
this
.button1.Dock = System.Windows.Forms.DockStyle.Right;
this
.button1.Location =
new
System.Drawing.Point(92, 0);
this
.button1.Name =
"button1"
;
this
.button1.Size =
new
System.Drawing.Size(28, 20);
this
.button1.TabIndex = 1;
this
.button1.Text =
"?"
;
this
.button1.UseVisualStyleBackColor =
true
;
//
// ccTest
//
this
.Controls.Add(
this
.textBox1);
this
.Controls.Add(
this
.button1);
this
.Name =
"ccTest"
;
this
.Size =
new
System.Drawing.Size(120, 20);
this
.ResumeLayout(
false
);
this
.PerformLayout();
}
#endregion
private
System.Windows.Forms.TextBox textBox1;
private
System.Windows.Forms.Button button1;
}
}
ccTest.cs:
using
System.Windows.Forms;
namespace
TestGridFocus
{
public
partial
class
ccTest : UserControl
{
public
ccTest()
{
InitializeComponent();
}
public
string
Value
{
get
{
return
textBox1.Text;
}
set
{
textBox1.Text = value;
}
}
}
}
Form1.Designer.cs:
namespace
TestGridFocus
{
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()
{
Telerik.WinControls.UI.GridViewDecimalColumn gridViewDecimalColumn1 =
new
Telerik.WinControls.UI.GridViewDecimalColumn();
Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn1 =
new
Telerik.WinControls.UI.GridViewTextBoxColumn();
Telerik.WinControls.UI.GridViewDecimalColumn gridViewDecimalColumn2 =
new
Telerik.WinControls.UI.GridViewDecimalColumn();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition1 =
new
Telerik.WinControls.UI.TableViewDefinition();
this
.radGridView1 =
new
Telerik.WinControls.UI.RadGridView();
((System.ComponentModel.ISupportInitialize)(
this
.radGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(
this
.radGridView1.MasterTemplate)).BeginInit();
this
.SuspendLayout();
//
// radGridView1
//
this
.radGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this
.radGridView1.Location =
new
System.Drawing.Point(12, 12);
//
//
//
this
.radGridView1.MasterTemplate.AllowAddNewRow =
false
;
gridViewDecimalColumn1.FieldName =
"id"
;
gridViewDecimalColumn1.HeaderText =
"id"
;
gridViewDecimalColumn1.Name =
"id"
;
gridViewDecimalColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
gridViewTextBoxColumn1.FieldName =
"name"
;
gridViewTextBoxColumn1.HeaderText =
"name"
;
gridViewTextBoxColumn1.Name =
"name"
;
gridViewTextBoxColumn1.Width = 150;
gridViewDecimalColumn2.FieldName =
"age"
;
gridViewDecimalColumn2.HeaderText =
"age"
;
gridViewDecimalColumn2.Name =
"age"
;
gridViewDecimalColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this
.radGridView1.MasterTemplate.Columns.AddRange(
new
Telerik.WinControls.UI.GridViewDataColumn[] {
gridViewDecimalColumn1,
gridViewTextBoxColumn1,
gridViewDecimalColumn2});
this
.radGridView1.MasterTemplate.ViewDefinition = tableViewDefinition1;
this
.radGridView1.Name =
"radGridView1"
;
this
.radGridView1.Size =
new
System.Drawing.Size(270, 237);
this
.radGridView1.TabIndex = 0;
this
.radGridView1.Text =
"radGridView1"
;
this
.radGridView1.CellBeginEdit +=
new
Telerik.WinControls.UI.GridViewCellCancelEventHandler(
this
.radGridView1_CellBeginEdit);
this
.radGridView1.CellEndEdit +=
new
Telerik.WinControls.UI.GridViewCellEventHandler(
this
.radGridView1_CellEndEdit);
//
// Form1
//
this
.AutoScaleDimensions =
new
System.Drawing.SizeF(6F, 13F);
this
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this
.ClientSize =
new
System.Drawing.Size(294, 261);
this
.Controls.Add(
this
.radGridView1);
this
.Name =
"Form1"
;
this
.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this
.Text =
"Form1"
;
this
.Load +=
new
System.EventHandler(
this
.Form1_Load);
((System.ComponentModel.ISupportInitialize)(
this
.radGridView1.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(
this
.radGridView1)).EndInit();
this
.ResumeLayout(
false
);
}
#endregion
private
Telerik.WinControls.UI.RadGridView radGridView1;
}
}
Form1.cs:
using
System;
using
System.Data;
using
System.Windows.Forms;
using
Telerik.WinControls;
namespace
TestGridFocus
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
DataTable GetData()
{
DataTable dt =
new
DataTable();
dt.Columns.Add(
"id"
,
typeof
(
int
));
dt.Columns.Add(
"name"
,
typeof
(
string
));
dt.Rows.Add(1,
"Jack"
);
dt.Rows.Add(2,
"Joe"
);
dt.Rows.Add(3,
"Bob"
);
dt.AcceptChanges();
return
dt;
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
radGridView1.DataSource = GetData();
}
ccTest test =
new
ccTest();
private
void
radGridView1_CellBeginEdit(
object
sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e)
{
if
(e.Column == radGridView1.Columns[
"name"
])
{
RadHostItem item =
new
RadHostItem(test);
test.Value = e.Row.Cells[e.ColumnIndex].Value.ToString();
radGridView1.CurrentCell.Children.Add(item);
item.HostedControl.Focus();
}
}
private
void
radGridView1_CellEndEdit(
object
sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if
(e.Column == radGridView1.Columns[
"name"
])
{
e.Row.Cells[e.ColumnIndex].Value = test.Value;
radGridView1.CurrentCell.Children.RemoveAt(0);
}
}
}
}
How do I set the column width of Excel to auto fit or any fix width in Cell Formatting? Thanks.
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(gvInventory);
SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
spreadExporter.CellFormatting += SpreadExporter_CellFormatting;
spreadExporter.ExportCompleted += SpreadExporter_ExportCompleted;
spreadExporter.RunExport(OutputFilePath, exportRenderer);
RadBradCrumb is a nice idea, but seems to be not really finished.
First, there is no documentation at all.
This little page gives a hint, this thing exists, not more.
https://docs.telerik.com/devtools/winforms/treeview/breadcrumb
Second, the splitbuttons and the dropdownItems are nice initialized and working,
but the DefaultItem of the SplitButton is not set.
You cannot click on the Button, und go up the hierarchie, the most basic function of a breadcrumb.
You always have this dropdown-things only.
Additionally, the RadBradCrumb is quiet a Closed thing, there are no events to subscribe, no virtual methods to override, just nothing.
I have found a workaround for this, which makes it work es expected, but this should be default functionality.
public class BreadCrumbHandler
{
private RadBreadCrumb crumb;
public BreadCrumbHandler(RadBreadCrumb crumb)
{
this.crumb = crumb;
// there is not other access to the DefaultItem of the SplitButtons in the BreadCrumb
var r = crumb.RootElement.Children.First() as RadBreadCrumbElement;
r.Items.ItemsChanged += BreadCrumb_ItemsChanged;
}
private void BreadCrumb_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
{
if (operation == ItemsChangeOperation.Inserted)
{
RadSplitButtonElement btn = target as RadSplitButtonElement;
if (btn != null)
{
var defaultItem = new RadMenuItem(btn.Text);
defaultItem.Text = btn.Text;
defaultItem.Click += DefaultItem_Click;
btn.DefaultItem = defaultItem;
}
}
else if (operation == ItemsChangeOperation.Clearing)
{
foreach (var item in changed.OfType<
RadSplitButtonElement
>())
{
var menuItem = item.DefaultItem as RadMenuItem;
if (menuItem != null)
menuItem.Click -= DefaultItem_Click;
item.DefaultItem = null;
}
}
else if (operation == ItemsChangeOperation.Removing)
{
RadSplitButtonElement btn = target as RadSplitButtonElement;
if (btn != null)
{
var menuItem = btn.DefaultItem as RadMenuItem;
if (menuItem != null)
menuItem.Click -= DefaultItem_Click;
btn.DefaultItem = null;
}
}
}
private void DefaultItem_Click(object sender, EventArgs e)
{
var menuItem = (RadMenuItem)sender;
var currentNode = crumb.DefaultTreeView.SelectedNode;
while (currentNode != null)
{
if (currentNode.Text == menuItem.Text) // not really safe test, but works as long as Texts are distinct
{
crumb.DefaultTreeView.SelectedNode = currentNode;
return;
}
currentNode = currentNode.Parent;
}
}
}
How to do paging with load on demand with radgridview in WinForm?
I have downloaded the demo of winform from Telerik. But the left starting part of source code is cut off. I am using Windows 7. Pressing left arrow did not go to the leftmost part (attached screen shot).
Where can I downloaded the source code of demo of winform?
I'm using column groups. Users can rearrange columns but i would like to prevent them from dragging columns to another group.
Thanks,
John