Is it possible to drag and drop from a grid view to a scheduler then the appointment will be set and save automatically??
For example in the same window I have grid view and scheduler
If there is a person call John in grid view that has a kind of an appointment, so when I drag that person from grid to scheduler the appointment should be automatically added to the selected place and time.
For more detail check the attached picture
Public
Class
CheckBoxCellElement
Inherits
GridDataCellElement
Private
chkBox
As
RadCheckBoxElement
Private
clickEvent
As
EventHandler
Public
Sub
New
(
ByVal
column
As
GridViewColumn,
ByVal
row
As
GridRowElement,
ByVal
extClickEvent
As
EventHandler)
MyBase
.
New
(column, row)
clickEvent = extClickEvent
End
Sub
Private
Sub
RadGridView1_CreateCell(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.GridViewCreateCellEventArgs)
Handles
RadGridView1.CreateCell
If
Not
TypeOf
e.Column
Is
CheckBoxColumn
OrElse
Not
TypeOf
e.Row
Is
GridDataRowElement
Then
Return
e.CellElement =
New
CheckBoxCellElement(e.Column, e.Row,
New
EventHandler(
AddressOf
CheckBoxElementClicked))
Private
Sub
CheckBoxElementClicked(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
If
Not
TypeOf
sender
Is
RadCheckBoxElement
OrElse
Not
TypeOf
e
Is
CheckBoxCellEventArgs
Then
Return
Dim
evArgs
As
CheckBoxCellEventArgs =
CType
(e, CheckBoxCellEventArgs)
RadGridView1.MasterTemplate.Rows(evArgs.ParentRowIndex).Cells(_ciParentRowOptionValueColIndex).Value = evArgs.NewValue
End
Sub
Hi,
I have downloaded the latest trial version of WinForms Q1 2011. I have added a new Telerik project and removed the original Form1 and added a RadForm. Then had added the Office2007Black theme. Added a SlitContainer with two horizontal panels. Now when I run the project and moved the form around the screen, it shows a trailing effect.
I have attached the screenshot with this.
Why is it so ?
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
namespace
RadControllTest
{
public
partial
class
Form5 : Form
{
RadGridView myGrid;
MyGridBehavior myGridBehavior;
public
Form5()
{
InitializeComponent();
SetupGrid();
}
private
void
SetupGrid()
{
myGrid =
new
RadGridView();
myGrid.Dock = DockStyle.Fill;
myGrid.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
myGrid.MultiSelect =
true
;
GridViewTextBoxColumn nameColumn =
new
GridViewTextBoxColumn(
"Name"
);
myGrid.Columns.Add(nameColumn);
myGrid.ViewCellFormatting +=
new
CellFormattingEventHandler(gridView_ViewCellFormatting);
myGrid.ChildViewExpanding +=
new
ChildViewExpandingEventHandler(gridView_ChildViewExpanding);
myGrid.CurrentRowChanging +=
new
CurrentRowChangingEventHandler(myGrid_CurrentRowChanging);
myGridBehavior =
new
MyGridBehavior();
myGrid.GridBehavior = myGridBehavior;
GridViewTemplate childTemplate =
new
GridViewTemplate();
myGrid.Templates.Add(childTemplate);
GridViewDecimalColumn idColumn =
new
GridViewDecimalColumn(
"ID"
);
childTemplate.Columns.Add(idColumn);
GridViewTextBoxColumn childNameColumn =
new
GridViewTextBoxColumn(
"Name"
);
childTemplate.Columns.Add(childNameColumn);
GridViewRelation relation =
new
GridViewRelation(myGrid.MasterTemplate, childTemplate);
relation.ChildColumnNames.Add(
"Children"
);
myGrid.Relations.Add(relation);
this
.Controls.Add(myGrid);
BindingList<MockParent> parents =
new
BindingList<MockParent>();
for
(
int
i = 0; i < 100; i++)
{
MockParent p =
new
MockParent(
"Parent "
+ i.ToString());
if
((i % 2) == 0)
{
BindingList<MockChild> children =
new
BindingList<MockChild>();
for
(
int
j = 1; j < 5; j++)
{
children.Add(
new
MockChild(j,
"Child "
+ j.ToString()));
}
p.Children = children;
}
parents.Add(p);
}
myGrid.DataSource = parents;
myGrid.AutoGenerateHierarchy =
true
;
childTemplate.ShowColumnHeaders =
false
;
childTemplate.ShowRowHeaderColumn =
false
;
}
void
myGrid_CurrentRowChanging(
object
sender, CurrentRowChangingEventArgs e)
{
System.Diagnostics.Debug.WriteLine(
"CurrentRowChanging"
);
if
(myGridBehavior.ExpanderClicked)
{
System.Diagnostics.Debug.WriteLine(
"CurrentRowChanging Canceled"
);
e.Cancel =
true
;
}
}
void
gridView_ChildViewExpanding(
object
sender, ChildViewExpandingEventArgs e)
{
if
((e.ParentRow !=
null
) && (e.ParentRow.ChildRows.Count < 1))
{
e.Cancel =
true
;
}
}
void
gridView_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
GridGroupExpanderCellElement cell = e.CellElement
as
GridGroupExpanderCellElement;
if
(cell !=
null
&& e.CellElement.RowElement
is
GridDataRowElement)
{
if
((cell.RowInfo.ChildRows !=
null
) && (cell.RowInfo.ChildRows.Count > 0))
{
cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible;
}
else
{
cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
}
}
}
private
class
MyGridBehavior : BaseGridBehavior
{
public
bool
ExpanderClicked {
get
;
set
; }
public
override
bool
OnMouseDown(MouseEventArgs e)
{
System.Diagnostics.Debug.WriteLine(
"MouseDown"
);
ExpanderClicked =
false
;
if
(
this
.CellAtPoint
is
GridGroupExpanderCellElement)
{
GridViewRowInfo row =
this
.CellAtPoint.RowInfo;
if
((row !=
null
) && (row.ChildRows.Count > 0))
{
ExpanderClicked =
true
;
}
}
return
base
.OnMouseDown(e);
}
public
override
bool
OnMouseUp(MouseEventArgs e)
{
System.Diagnostics.Debug.WriteLine(
"MouseUp"
);
ExpanderClicked =
false
;
return
base
.OnMouseUp(e);
}
}
private
class
MockParent
{
public
string
Name {
get
;
set
; }
public
BindingList<MockChild> Children {
get
;
set
; }
public
MockParent(
string
s)
{
Name = s;
}
}
private
class
MockChild
{
public
int
ID {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
MockChild(
int
id,
string
s)
{
ID = id;
Name = s;
}
}
}
}
Hi
I didn't see RadMessageBox listed in my toolbox ! From where can I add it ?