or
<
telerik:RadGridView
Name
=
"rcGridView"
Grid.Row
=
"0"
Margin
=
"15"
ItemsSource="{Binding Users,
NotifyOnSourceUpdated
=
True
,
UpdateSourceTrigger
=
PropertyChanged
,
Mode
=
TwoWay
}"
AutoGenerateColumns
=
"False"
ClipToBounds
=
"False"
SelectionMode
=
"Extended"
VerticalAlignment
=
"Stretch"
telerik:StyleManager.Theme
=
"Summer"
RowHeight
=
"20"
RowIndicatorVisibility
=
"Collapsed"
CanUserInsertRows
=
"False"
CanUserDeleteRows
=
"False"
HorizontalAlignment
=
"Left"
FontSize
=
"11"
ClipboardCopyMode
=
"All"
ClipboardPasteMode
=
"AllSelectedCells,Default"
SelectionUnit
=
"FullRow"
CanUserFreezeColumns
=
"False"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
>
<
telerik:RadContextMenu.Items
>
<
telerik:RadMenuItem
Header
=
"Approve"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource
FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoApproveCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
<
telerik:RadMenuItem
Header
=
"Hold"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoHoldCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
<
telerik:RadMenuItem
Header
=
"Reject"
Command="{Binding
UpdateSourceTrigger
=
Default
,
NotifyOnSourceUpdated
=
True
,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type
telerik:RadContextMenu}},
Path
=
DataContext
.StatChgtoRejectCommand}"
CommandParameter
=
"{Binding ElementName=rcGridView, Path=SelectedItems}"
/>
</
telerik:RadContextMenu.Items
>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding ID}"
/>
<
telerik:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
Header
=
"Status"
DataMemberBinding
=
"{Binding Status}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports Telerik.WinControls.UI
Imports Telerik.WinControls.Data
' EVENT HANDLER FOR APPOINTMENTS COLLECTION CHANGED CALLS FUNCTION
' Appointments_CollectionChanged()
' CAN ADD THIS TO THE FORM_LOAD EVENT
AddHandler
RadScheduler1.Appointments.CollectionChanged,
AddressOf
Appointments_CollectionChanged
'Appointments_CollectionChanged()
Private
Function
Appointments_CollectionChanged(
ByVal
sender
As
Object
,
ByVal
e
As
NotifyCollectionChangedEventArgs)
As
String
' WILL PASS A ACTION TO CollectionChangedCompleted()
' DEPENDING ON THE ACTION PERFORMED AT RUNTIME
Select
Case
e.Action
Case
NotifyCollectionChangedAction.Add
CollectionChangedCompleted(
"Add"
)
Case
NotifyCollectionChangedAction.Batch
CollectionChangedCompleted(
"Batch"
)
Case
NotifyCollectionChangedAction.ItemChanged
CollectionChangedCompleted(
"ItemChanged"
)
Case
NotifyCollectionChangedAction.ItemChanging
CollectionChangedCompleted(
"ItemChanging"
)
Case
NotifyCollectionChangedAction.Move
CollectionChangedCompleted(
"Move"
)
Case
NotifyCollectionChangedAction.Remove
CollectionChangedCompleted(
"Remove"
)
Case
NotifyCollectionChangedAction.Replace
CollectionChangedCompleted(
"Replace"
)
Case
NotifyCollectionChangedAction.Reset
CollectionChangedCompleted(
"Reset"
)
End
Select
Return
String
.Empty
End
Function
' CollectionChangedCompleted()
' THIS FUNCTION CHECKS TO MAKE SURE THE RadScheduler APPOINTMENTS
' WHERE UPDATED
Private
Function
CollectionChangedCompleted(
ByVal
action
As
String
)
As
Boolean
If
RadScheduler1.Appointments.IsUpdated
Then
' FORWARD THE ACTION TO performAction()
' FOR PROCESSING CUSTOM OPERATIONS
performAction(action)
Return
True
Else
Return
False
End
If
Return
False
End
Function
' performAction()
Private
Function
performAction(
ByVal
action
As
String
)
As
Boolean
Select
Case
action
Case
"Add"
'DO CUSTOM OPERATIONS
' ie: updating your datasource/database
' WITH OUT THE NEED FOR A "SAVE/UPDATE" BUTTON
' AUTOMATED UPDATING :)
Case
"Batch"
'DO CUSTOM OPERATIONS
Case
"ItemChanged"
'DO CUSTOM OPERATIONS
Case
"ItemChanging"
'DO CUSTOM OPERATIONS
Case
"Move"
'DO CUSTOM OPERATIONS
Case
"Remove"
'DO CUSTOM OPERATIONS
Case
"Replace"
'DO CUSTOM OPERATIONS
Case
"Reset"
'DO CUSTOM OPERATIONS
End
Select
End
Function
' CALL TO APPLY COLORS TO RESOURCES!!!!
Private
Sub
applyResourceColors()
Dim
colors()
As
Color = {Color.LightPink, Color.LightBlue, Color.LightCyan, Color.LightGreen, Color.LightSalmon, Color.LightYellow, Color.LightCoral}
Dim
i
As
Integer
= 0
For
Each
res
As
Resource
In
RadScheduler1.Resources
res.Color = colors(i)
' TO MAKE SURE WE DON'T GO OUT OF RANGE FOR THE COLORS() ARRAY
' IF WE REACH OUR ZERO BASED INDEX COUNT ON COLORS ARRAY WE RESET i TO 0
' ALLOWING IT TO REPEAT THE COLORS
Dim
colorsCount
As
Integer
= colors.Count
If
Not
i = colorsCount
Then
i += 1
Else
i = 0
End
If
Next
End
Sub