Back to Devexpress

DashboardDesigner.DashboardCustomPropertyChanged Event

dashboard-devexpress-dot-dashboardwin-dot-dashboarddesigner-58811629.md

latest7.0 KB
Original Source

DashboardDesigner.DashboardCustomPropertyChanged Event

Occurs when the custom property value in the Dashboard Designer is changed.

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public event CustomPropertyChangedEventHandler DashboardCustomPropertyChanged
vb
Public Event DashboardCustomPropertyChanged As CustomPropertyChangedEventHandler

Event Data

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

PropertyDescription
NameGets a custom property name for which the event is raised.
NewValueGets a new value that has been assigned to the custom property.
OldValueGets the custom property’s previous value, which has been replaced by the new value.
OwnerGets a level at which a custom property is recorded.

Remarks

In comparison to the Dashboard.OptionsChanged and DashboardDesigner.DashboardOptionsChanged events, the DashboardCustomPropertyChanged event occurs when the custom property value is changed. The change does not have to be recorded in the history.

The following example shows how to change the ribbon button checked status when you enable or disable the custom property:

csharp
public class ChartScaleBreakModule {
  // ...
  public static readonly string PropertyName = "ScaleBreak";

  void Designer_DashboardCustomPropertyChanged(object sender, CustomPropertyChangedEventArgs e) {
      if(e.Name == PropertyName)
          UpdateBarItem();
  }

  void UpdateBarItem() {
      barItem.Checked = designer.SelectedDashboardItem.CustomProperties.GetValue<bool>(PropertyName);
  }
  public static T GetValue<T>(this CustomProperties property, string name) where T : struct {
      var value = property.GetValue(name);
      if(value == null) return default(T);
      return (T)Convert.ChangeType(value, typeof(T));
  }
}
vb
Public Class ChartScaleBreakModule
  ' ...
  Public Shared ReadOnly PropertyName As String = "ScaleBreak"

  Private Sub Designer_DashboardCustomPropertyChanged(ByVal sender As Object, ByVal e As CustomPropertyChangedEventArgs)
      If e.Name = PropertyName Then
          UpdateBarItem()
      End If
  End Sub

  Private Sub UpdateBarItem()
      barItem.Checked = designer.SelectedDashboardItem.CustomProperties.GetValue(Of Boolean)(PropertyName)
  End Sub
   _
  Public Shared Function GetValue(Of T As Structure)(ByVal [property] As CustomProperties, ByVal name As String) As T
      Dim value = [property].GetValue(name)
      If value Is Nothing Then
          Return Nothing
      End If
      Return CType(Convert.ChangeType(value, GetType(T)), T)
  End Function
End Class

The following code snippets (auto-collected from DevExpress Examples) contain references to the DashboardCustomPropertyChanged 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.

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/DashboardDescriptionModule.cs#L30

csharp
designer.CustomizeDashboardTitle += Designer_CustomizeDashboardTitle;
    designer.DashboardCustomPropertyChanged += Designer_DashboardCustomPropertyChanged;
}

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Heatmap/HeatmapItemExtensionModule.cs#L31

csharp
designer.CreateCustomItemBars(typeof(HeatmapItemMetadata));
designer.DashboardCustomPropertyChanged += UpdateBarsEventHandler;
designer.DashboardItemSelected += UpdateBarsEventHandler;

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/DashboardDescriptionModule.vb#L30

vb
AddHandler designer.CustomizeDashboardTitle, AddressOf Designer_CustomizeDashboardTitle
    AddHandler designer.DashboardCustomPropertyChanged, AddressOf Designer_DashboardCustomPropertyChanged
End Sub

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/Heatmap/HeatmapItemExtensionModule.vb#L41

vb
designer.CreateCustomItemBars(GetType(HeatmapItemMetadata))
AddHandler designer.DashboardCustomPropertyChanged, AddressOf UpdateBarsEventHandler
AddHandler designer.DashboardItemSelected, AddressOf UpdateBarsEventHandler

Implements

DashboardCustomPropertyChanged

See Also

Create Custom Properties

DashboardDesigner Class

DashboardDesigner Members

DevExpress.DashboardWin Namespace