Back to Devexpress

SchedulerControlBase.DependencyPropertyChanged Event

wpf-devexpress-dot-xpf-dot-scheduling-dot-schedulercontrolbase.md

latest7.4 KB
Original Source

SchedulerControlBase.DependencyPropertyChanged Event

Occurs when any SchedulerControl’s dependency property is changed.

Namespace : DevExpress.Xpf.Scheduling

Assembly : DevExpress.Xpf.Scheduling.v25.2.dll

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public event DependencyPropertyChangedEventHandler DependencyPropertyChanged
vb
Public Event DependencyPropertyChanged As DependencyPropertyChangedEventHandler

Event Data

The DependencyPropertyChanged event's data class is DependencyPropertyChangedEventArgs. The following properties provide information specific to this event:

PropertyDescription
NewValueGets the value of the property after the change.
OldValueGets the value of the property before the change.
PropertyGets the identifier for the dependency property where the value change occurred.

The event data class exposes the following methods:

MethodDescription
Equals(Object)Determines whether the provided object is equivalent to the current DependencyPropertyChangedEventArgs.
Equals(DependencyPropertyChangedEventArgs)Determines whether the provided DependencyPropertyChangedEventArgs is equivalent to the current DependencyPropertyChangedEventArgs.
GetHashCode()Gets a hash code for this DependencyPropertyChangedEventArgs.
ToString()Returns the fully qualified type name of this instance. Inherited from ValueType.

Remarks

Handle this event to determine whether a certain dependency property is changed.

This event can be used instead of the legacy SchedulerControl.SelectionChanged event, as illustrated in the following code snippet:

csharp
private void schedulerControl_DependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs e) {
    SchedulerControl scheduler = sender as SchedulerControl;
    if (e.Property == SchedulerControl.SelectedIntervalProperty) {
        OutputBox.AppendText(string.Format("SelectedInterval is changed. New value is {0} \r\n", e.NewValue));
        OutputBox.ScrollToEnd();
    }
    if (e.Property == SchedulerControl.SelectedResourceProperty) {
        OutputBox.AppendText(string.Format("SelectedResource is changed. New value is {0} \r\n", ((ResourceItem)e.NewValue).Caption));
        OutputBox.ScrollToEnd();
    }
}
vb
Private Sub schedulerControl_DependencyPropertyChanged(ByVal sender As Object, ByVal e As DependencyPropertyChangedEventArgs)
    Dim scheduler As SchedulerControl = TryCast(sender, SchedulerControl)
    If e.Property = SchedulerControl.SelectedIntervalProperty Then
        OutputBox.AppendText(String.Format("SelectedInterval is changed. New value is {0} " & ControlChars.CrLf, e.NewValue))
        OutputBox.ScrollToEnd()
    End If
    If e.Property = SchedulerControl.SelectedResourceProperty Then
        OutputBox.AppendText(String.Format("SelectedResource is changed. New value is {0} " & ControlChars.CrLf, CType(e.NewValue, ResourceItem).Caption))
        OutputBox.ScrollToEnd()
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DependencyPropertyChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-scheduler-obtain-selected-appointment-resource-and-time-interval/CS/DXSchedulerSelection/MainWindow.xaml#L37

xml
ActiveViewIndex="0"
DependencyPropertyChanged="schedulerControl_DependencyPropertyChanged"
FirstDayOfWeek="Monday"

wpf-scheduler-obtain-selected-appointment-resource-and-time-interval/CS/DXSchedulerSelection/obj/Debug/net5.0-windows/MainWindow.g.cs#L120

csharp
#line 37 "..\..\..\MainWindow.xaml"
this.schedulerControl.DependencyPropertyChanged += new System.Windows.DependencyPropertyChangedEventHandler(this.schedulerControl_DependencyPropertyChanged);

wpf-scheduler-obtain-selected-appointment-resource-and-time-interval/VB/DXSchedulerSelection/obj.NetFX/Debug/MainWindow.g.vb#L118

vb
#ExternalSource("..\..\MainWindow.xaml",37)
AddHandler Me.schedulerControl.DependencyPropertyChanged, New System.Windows.DependencyPropertyChangedEventHandler(AddressOf Me.schedulerControl_DependencyPropertyChanged)

See Also

SchedulerControlBase Class

SchedulerControlBase Members

DevExpress.Xpf.Scheduling Namespace