dashboard-403250-winforms-dashboard-winforms-designer-ui-elements-and-customization-create-a-custom-item-custom-item-troubleshooting.md
The article describes how to resolve possible issues when you create or integrate a custom item into your project.
You created data item sections in metadata, but they are not displayed in the UI.
You changed or deleted a data item in the UI, but the custom item still displays old data.
Make sure that you correctly declared metadata properties.
Ensure that the Measure and Dimension property declarations include the GetPropertyValue and SetPropertyValue methods.
Make sure that Measure and Dimension collections are readonly.
The selected custom item element is unselected when you maximize the custom item.
Make sure that the SetSelection method is called, and the control’s elements are selected in this method.
For example, the following code updates a custom control according to the current master filter selection for the custom Funnel item:
protected override void SetSelection(CustomItemSelection selection){
chart.ClearSelection();
foreach (DashboardFlatDataSourceRow item in selection.GetDashboardFlatDataSourceRows(flatData))
chart.SelectedItems.Add(item);
}
Protected Overrides Sub SetSelection(ByVal selection As CustomItemSelection)
chart.ClearSelection()
For Each item As DashboardFlatDataSourceRow In selection.GetDashboardFlatDataSourceRows(flatData)
chart.SelectedItems.Add(item)
Next item
End Sub
When you use a custom item to filter a dashboard item, the filter is applied but the custom item element is unselected.
Make sure the SetSelection method is called and you manage the control’s element selection in the SetSelection method.
Make sure that methods in which you implement master filtering and drill-down logic are called, and you pass the correct parameters to the SetMasterFilter or PerformDrillDown method.
Custom item bars are not displayed in the UI.
A custom item button does not display its icon.
Make sure that the icon file’s Build Action property is set to Embedded Resource.
If the icon is in the same assembly where the CustomItemMetadata object is defined, make sure that the correct file path is passed as an argument to the CustomItemImageAttribute constructor. Call the Assembly.GetManifestResourceNames method to return the names of all resources in the assembly.
If the icon is in another assembly, pass both the icon’s file path and any class type from the assembly where the file is located to the CustomItemImageAttribute constructor.
Master Filter and Drill-Down buttons are not displayed in the Ribbon’s Data page for a custom item.
Make sure that you apply SupportInteractivityAttribute to the interactive Dimension property in metadata.
The event does not occur when a dashboard control visualizes a custom item.
Make sure that you registered metadata for the corresponding custom item in the CustomItemMetadataTypes collection.
The CustomDashboardItemConfigurationException is raised and the following message appears:
Dashboard item configuration error. Please contact the application vendor or system administrator for assistance.
Catch CustomDashboardItemConfigurationException to obtain the description of possible issues.
A custom control that visualizes a custom item does not update custom item data once you change it in the UI.
Make sure that the UpdateControl method is called when a custom item’s data or settings change. Update all properties and objects initialized in the method and ensure that the custom control uses them.
For example, the following code binds a custom Sankey chart item to data:
protected override void UpdateControl(CustomItemData customItemData) {
multiDimensionalData = customItemData.GetMultiDimensionalData();
flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() { AddColoringColumns = true, AddDisplayTextColumns = true });
ClearBindings();
SetDataBindings(flatData);
}
void ClearBindings() {
sankey.DataSource = null;
sankey.Colorizer = null;
sankey.SourceDataMember = null;
sankey.TargetDataMember = null;
sankey.WeightDataMember = null;
}
void SetDataBindings(DashboardFlatDataSource flatData) {
sankey.SourceDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Source.UniqueId).Name;
sankey.TargetDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Target.UniqueId).Name;
if(dashboardItem.Metadata.Weight != null)
sankey.WeightDataMember = dashboardItem.Metadata.Weight.UniqueId;
try {
sankey.DataSource = flatData;
} catch {
sankey.DataSource = null;
}
}
Protected Overrides Sub UpdateControl(ByVal customItemData As CustomItemData)
multiDimensionalData = customItemData.GetMultiDimensionalData()
flatData = customItemData.GetFlatData(New DashboardFlatDataSourceOptions() With {
.AddColoringColumns = True,
.AddDisplayTextColumns = True
})
ClearBindings()
SetDataBindings(flatData)
End Sub
Private Sub ClearBindings()
sankey.DataSource = Nothing
sankey.Colorizer = Nothing
sankey.SourceDataMember = Nothing
sankey.TargetDataMember = Nothing
sankey.WeightDataMember = Nothing
End Sub
Private Sub SetDataBindings(ByVal flatData As DashboardFlatDataSource)
sankey.Colorizer = New SankeyItemColorizer(flatData)
sankey.SourceDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Source.UniqueId).Name
sankey.TargetDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Target.UniqueId).Name
If dashboardItem.Metadata.Weight IsNot Nothing Then
sankey.WeightDataMember = dashboardItem.Metadata.Weight.UniqueId
End If
Try
sankey.DataSource = flatData
Catch
sankey.DataSource = Nothing
End Try
End Sub
The GUID is shown instead of “Others”When you enable Top N with the Show “Others” value option, the GUID is displayed in a custom item instead of “Others” value.Group Intervals display unformatted valuesNumeric values or unformatted DateTime values are shown instead of Group Intervals (such as Quarter, Month, Year-Quarter, and so on).Measure formatting is not appliedCustom item data contains unformatted measure values.
The DashboardFlatDataSource object contains data columns with unformatted measure and dimension values. You can use display text columns to visualize formatted values in the resulting custom item’s view. Replace data item values with their display text and visualize it in a custom item. To accomplish this, refer to detailed description in the following methods:
Catch CustomDashboardItemConfigurationException to identify which errors have occurred during dashboard initialization.
You can do it in the following ways:
Use the Visual Studio Exception Settings dialog.
Handle the FirstChanceException event.